Add safe catch-all for secp256k1::Error conversion in HpkeError#1298
Add safe catch-all for secp256k1::Error conversion in HpkeError#1298spacebear21 merged 1 commit intopayjoin:masterfrom
Conversation
Pull Request Test Coverage Report for Build 22723399575Details
💛 - Coveralls |
benalleng
left a comment
There was a problem hiding this comment.
cACK seems simple enough, not sure if there was another approach in mind but this seems simple enough to catch the unhandled errors
| InvalidKeyLength, | ||
| PayloadTooLarge { actual: usize, max: usize }, | ||
| PayloadTooShort, | ||
| Other(String), |
There was a problem hiding this comment.
I think we should name the variant more explicitly, and keep the inner details opaque.
| Other(String), | |
| UnexpectedSecp256k1Error, |
There was a problem hiding this comment.
What was the rationale for keeping the inner details unrecorded @spacebear21 ? I can understand leaving them opaque, but I think that could be done with a private tuple field rather than choosing to discard. This is pretty minor afaict but would help surface real problems in error logs if they ever were to arise and we should document that the decision was deliberate so we can close the thread on this for 1.0 error stabiliazation https://github.com/DanGould/rust-payjoin/pull/9/changes.
There was a problem hiding this comment.
HpkeError is only used in opaque Internal error variants, it just seemed like information overload and inelegant to store as a string. I guess an opaque tuple field would be fine
Replace panic with Other(String) variant to handle unknown secp256k1 error variants. This prevents crashes for unknown varients and if new variants are added upstream.
Closes: #1274
Replace panic with a match to Other(String) to handle unknown secp256k1 error variants. This prevents crashes for unknown varients and if new variants are added upstream.
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.