Propagate ParseError when retrieving ohttp parameter#428
Propagate ParseError when retrieving ohttp parameter#428DanGould merged 2 commits intopayjoin:masterfrom
Conversation
|
Heck yes we are. Seeing PRs open like this in the morning is like seeing flower buds appear in the garden. Thanks for the contribution @shinghim ✨ Check out the contributing section of the readme to figure out what the CI expects for formatting. You can also run tests locally as long as Docker is running with |
|
Gotcha, I was waiting till I could figure out the testing bit before making this ready for review - I’ll work on that when I get some free time and the ‘exp’ part as well |
payjoin/src/ohttp.rs
Outdated
|
|
||
| #[derive(Debug)] | ||
| pub enum ParseOhttpKeysError { | ||
| MissingOhttpKeys, |
There was a problem hiding this comment.
I do think this is probably an error variant that belongs in url_ext and NOT ohttp.rs. Only url_ext has the concept of the parameter being "missing." This type that gets defined in url_ext will likely include whatever error variant exp or other fragment parameters have. Maybe it's a pub enum FragmentError.
There was a problem hiding this comment.
That makes sense. I had the same question while doing this, but I saw here that MissingPubkey is in the same ParseReceiverPubkeyError. Does it make sense to move ParseOhttpKeysError to the error module?
There was a problem hiding this comment.
Hmm the url ParseReceiverPubkeyError that you linked to seems to be better form to me since it's specifically regarding parsing a pubkey out of the receiver pubkey from the Url fragment, and handles the variant regarding the actual pubkey contents as InvalidPubkey(crate::hpke::HpkeError).
I don't think you want to move ParseOhttpKeysError but rather create a new variant that contains it, following the same pattern. I can see how the name of the parse error in ohttp follows the same pattern a the parse receiver pubkey [param] error and that is confusing.
I'd make a ParseOhttpKeysParamError that has an InvalidOhttpKeys(crate::ohttp::ParseOhttpKeysError) variant as well as the missing keys variant, and consider renaming ParseReceiverPubkeyError into ParseReceiverPkParamError or similar.
ParseOhParamError and ParseRkParamError etc. naming by the HRP could work too.
I'm not 100% on the names but I think this explains the difference between the layers of abstraction and why the existing names may have caused confusion.
75662e7 to
c9509fd
Compare
Pull Request Test Coverage Report for Build 12200340472Details
💛 - Coveralls |
This change will differentiate between parsing a receiver pubkey in the context of a URL and other formats
c9509fd to
accdaca
Compare
|
Fixed the formatting and integration tests |
Not sure if you guys are accepting contributions, but I recently came across payjoins and thought it was a cool idea and wanted to see if i could contribute.
This PR will update the
ohttp()getter to propagate the parse errors as part of #399. If this looks good, i can submit another patch to do the same forexp()