Replace panic!/panic_with_error! with typed errors; add missing error…#184
Open
happyboy24 wants to merge 1 commit into
Open
Replace panic!/panic_with_error! with typed errors; add missing error…#184happyboy24 wants to merge 1 commit into
happyboy24 wants to merge 1 commit into
Conversation
… tests - Convert init() from panic_with_error!(AlreadyInitialized) to return Err(Error::AlreadyInitialized); change signature to Result<(), Error> so callers get a typed error not a trap - Replace accept_admin ok_or(NotInitialized) with the new NoPendingAdmin variant for accurate error semantics - Add NoPendingAdmin = 8 to the Error enum - Doc-comment every Error variant for ABI documentation - Remove now-unused panic_with_error import - Convert init_is_one_shot test from #[should_panic] to try_init + assert_eq!(Err(Ok(Error::AlreadyInitialized))) - Add 9 new tests covering NotInitialized on all admin entry- points and NoPendingAdmin on accept_admin All 26 tests pass; grep confirms zero panic!/unwrap()/expect() in contract source.
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.
… tests
All 26 tests pass; grep confirms zero panic!/unwrap()/expect() in contract source.
Summary
Checklist
npm testpasses).closes Audit: review all panic! sites in the validator contract and replace with proper errors #59