refactor: introduce PerstackError for user-facing error handling#527
Merged
refactor: introduce PerstackError for user-facing error handling#527
Conversation
Add PerstackError class to distinguish known user-facing errors (message only, exit 1) from unexpected bugs (stack trace crash). Centralize error handling at CLI entry points via parseAsync().catch(), remove per-handler try/catch blocks, and replace ProviderNotInstalledError with PerstackError. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert missed throw sites found during code review: - parseExpertKey validation in core/schemas/runtime.ts - run-manager.ts checkpoint/run lookup errors in tui - command-args.ts skill config validation in runtime Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Found by second round of full-codebase review: - setup-experts.ts: delegate resolution error - providers (anthropic, azure-openai, google, openai): config validation for custom skill JSON and missing vectorStoreIds/fileSearchStoreNames - tui-components: user-initiated cancellation (Ctrl+C) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e41896d to
b2bf3b1
Compare
Merged
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.
Summary
PerstackErrorclass to@perstack/coreto distinguish known user-facing errors from unexpected bugsPerstackError→ message only + exit(1), plainError→ stack trace crash for debuggingprogram.parseAsync().catch(...)) in bothperstackandcreate-expertstartHandler,runHandler,logHandler,installHandlerPerstackErrorfor validation, config, env var, and API errorsProviderNotInstalledErrorwithPerstackErrorand remove the old classTest plan
pnpm typecheck— 22/22 packages passpnpm test— 100 test files, 1090 tests passpnpm build— 22/22 packages buildpnpm format-and-lint— no new warningsperstack startwithoutperstack.tomlshows clean message + exit(1), no stack tracethrow new Error("boom")produces stack trace crash🤖 Generated with Claude Code