[#1693] cli/lens: Replace conditional panics with asserts
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m9s
Pre-commit hooks / Pre-commit (push) Successful in 1m31s
Build / Build Components (push) Successful in 2m19s
Tests and linters / Tests (push) Successful in 3m20s
Tests and linters / gopls check (push) Successful in 3m40s
Tests and linters / Staticcheck (push) Successful in 3m42s
Tests and linters / Run gofumpt (push) Successful in 3m58s
Tests and linters / Lint (push) Successful in 4m26s
Tests and linters / Tests with -race (push) Successful in 5m53s
OCI image / Build container images (push) Successful in 4m4s

Change-Id: Id827da0cd9eef66efd806be6c9bc61044175a971
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2025-04-07 19:25:57 +03:00
parent 0e1b01b15f
commit 766d9ec46b
2 changed files with 5 additions and 8 deletions

View file

@ -3,6 +3,8 @@ package common
import (
"errors"
"fmt"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/assert"
)
type FilterResult byte
@ -71,11 +73,7 @@ func (fp FallbackParser) ToParser() Parser {
func (p Parser) ToFallbackParser() FallbackParser {
return func(key, value []byte) (SchemaEntry, Parser) {
entry, next, err := p(key, value)
if err != nil {
panic(fmt.Errorf(
"couldn't use that parser as a fallback parser, it returned an error: %w", err,
))
}
assert.NoError(err, "couldn't use that parser as a fallback parser")
return entry, next
}
}

View file

@ -8,6 +8,7 @@ import (
"sync"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal/schema/common"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/assert"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
@ -94,9 +95,7 @@ func (v *RecordsView) Mount(ctx context.Context) error {
}
func (v *RecordsView) Unmount() {
if v.onUnmount == nil {
panic("try to unmount not mounted component")
}
assert.False(v.onUnmount == nil, "try to unmount not mounted component")
v.onUnmount()
v.onUnmount = nil
}