fix(devnet): only show init hint for InitializationError#408
Merged
fix(devnet): only show init hint for InitializationError#408
Conversation
|
✅ Changeset file detected. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines offckb devnet config error handling so the “run offckb node once…” initialization hint is only shown for true devnet initialization failures, instead of for all errors (including user input/validation issues).
Changes:
- Introduces
InitializationErrorin the devnet config editor and throws it for missing config path / missing required TOML files. - Updates
devnetConfigto conditionally print the initialization hint only when catchingInitializationError, while improving catch type-safety. - Adds unit tests to verify hint behavior across parse errors, validation/unknown-field errors, and initialization errors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/devnet/config-editor.ts |
Adds InitializationError and uses it for missing path/config-file checks. |
src/cmd/devnet-config.ts |
Prints the initialization hint only for InitializationError; safer error-to-message handling. |
tests/devnet-config-command.test.ts |
Adds tests ensuring the hint is suppressed for non-init errors and shown for init errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| describe('error handling with init hint', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #406
Problem
`offckb devnet config` was showing the "run `offckb node` once to initialize devnet config files first" hint for ALL errors, including user input errors like invalid `--set` syntax or validation failures. This was misleading.
Solution
Changes
Testing