Skip to content

Replace production unwrap() with descriptive expect() messages#817

Open
wangzi111333 wants to merge 1 commit into
jarchain:masterfrom
wangzi111333:fix/unwrap-to-expect
Open

Replace production unwrap() with descriptive expect() messages#817
wangzi111333 wants to merge 1 commit into
jarchain:masterfrom
wangzi111333:fix/unwrap-to-expect

Conversation

@wangzi111333
Copy link
Copy Markdown

Summary

Replace bare unwrap() calls in non-test production code with expect() that provides context for debugging:

  • grey-rpc (5): 4 HTTP response construction unwraps + 1 mutex lock
  • grey/node (2): SystemTime + pending block lookup
  • grey/main (1): SystemTime for genesis time
  • javm/kernel (2): cap.split() after bounds checks
  • grey-erasure (1): originals collection after all(Some) check

All of these were infallible by construction, but expect() makes the invariant explicit and provides a useful message if violated.

Refs #186

Replace bare unwrap() calls in non-test production code with expect()
that provides context for debugging if the unlikely panic occurs:

- grey-rpc: 4 HTTP response construction + 1 mutex lock
- grey/node: 2 SystemTime + pending block lookup
- grey/main: 1 SystemTime (genesis time)
- javm/kernel: 2 cap.split() calls
- grey-erasure: 1 originals collection

Refs jarchain#186.
@github-actions
Copy link
Copy Markdown
Contributor

Genesis Review

Comparison targets:

How to review

Post a comment with the following format (rank from best to worst):

/review
difficulty: <commit1>, <commit2>, ..., <commitN>, currentPR
novelty: <commit1>, <commit2>, ..., <commitN>, currentPR
design: <commit1>, <commit2>, ..., <commitN>, currentPR
verdict: merge

Use the short commit hashes above and currentPR for this PR.
Each line ranks all comparison targets + this PR from best to worst.

To meta-review another reviewer's comment, react with 👍 or 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant