Repository navigation
refactor!: propagate errors instead of panicking - #1845
mbrandenburger merged 1 commit into
Conversation
|
Hey @mbrandenburger 👋 thanks for the PR! This comment updates automatically as you push changes -- think of it as your PR's live scoreboard! PR Checks✅ DCO Sign-off -- All commits have valid sign-offs. Nice work! ❌ GPG Signature -- Heads up! The following commits don't have a verified GPG signature:
You'll need to sign your commits with GPG (e.g. ✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing! ✅ Issue Link -- Linked to #1843 (assigned to you). ⏳ All checks must pass before this PR can be reviewed. You've got this! |
|
Tick the box to add this pull request to the merge queue (same as
|
utils.Must/utils.MustGet turn an error into a panic. Four call sites on the node-startup / store-construction path panicked despite every enclosing function already returning error and already propagating sibling errors normally: newKVS, GetPersistenceName, and the two GetTableNames functions. They now return the error instead of crashing the process. Also fixes escapeForTableName's bare panic on the same call path: Fabric channel names legally contain digits, but escapeForTableName validated against ^[a-zA-Z_]+$, so a channel named e.g. mychannel1 panicked at vault store construction instead of surfacing the existing wrapped error at channelprovider.go. Wrap errors.Wrapf around the entry points that would otherwise lose context on propagation (GetPersistenceName, Format, both GetTableNames), add godoc to the constructors and helpers on this call path, and replace the remaining utils.MustGet calls in sqlite tests and benchmarks with testify require / plain error propagation. BREAKING CHANGE: (*TableNameCreator).MustGetTableName is removed from platform/view/services/storage/db; call CreateTableName and handle the error instead. Table-name and persistence-name construction on the store startup path (GetPersistenceName, GetTableNames, and escapeForTableName's callers) no longer panics on invalid config or channel names; callers that relied on that fail-fast crash now receive a normal error return. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
275a11c to
219afaa
Compare
Summary
utils.Must/utils.MustGetturned errors into panics at four call sites on the node-startup / store-construction path (newKVS,GetPersistenceName, and twoGetTableNamesfunctions), even though every enclosing function already returned an error. They now return the error instead of crashing the process.escapeForTableNamealso panicked on channel names containing digits, a legal Fabric channel name, since it validated against^[a-zA-Z_]+$. That's fixed too, so the existing wrapped error atchannelprovider.gosurfaces instead of a crash.errors.Wrapfat the entry points that would otherwise lose context (GetPersistenceName,Format, bothGetTableNames), added godoc to the constructors/helpers on this path, and replaced the remainingutils.MustGetcalls in sqlite tests/benchmarks with testifyrequireor plain error propagation.Breaking change
(*TableNameCreator).MustGetTableNameis removed fromplatform/view/services/storage/db. CallCreateTableNameand handle the error instead.Fixes #1843
Test plan
make checksmake unit-tests