-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor error handling #702
Conversation
Codecov Report
@@ Coverage Diff @@
## main #702 +/- ##
==========================================
+ Coverage 63.43% 64.16% +0.72%
==========================================
Files 234 239 +5
Lines 22961 22646 -315
Branches 5195 5085 -110
==========================================
- Hits 14566 14531 -35
+ Misses 4242 3972 -270
+ Partials 4153 4143 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
As the previous PR got merged and squashed at merge, this created bunch of merge conflicts, I'll probably squash this entire PR after review as well, to get around it. |
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
61380f2
to
3d2ab04
Compare
Not sure if i'll have time for review tonight sorry - hopefully tomorrow. But just had an initial look - was wondering, what inspired the change from My understanding was that |
@gmulhearn good point! I didn't realize there was this convention but looking at bunch of crates, you are right. I'll keep the original naming style |
Signed-off-by: Patrik Stas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactor! looks good, just left a few comments.
All the libvcx error handling makes me wish we had something like uniffi... ;). UniFFI lets you pass thiserror
's thru the layer and they're automatically transformed into kotlin/swift exceptions and errors, maintaining the types and comments.
I'm tempted to try make a POC of uniffi with aries-vcx to demostrate
Thanks for review, good caches! All comments addressed. (eh, I need to push that commit, will do that in an hour or two) I'd be very cool to see uniffi in action. So far we dabbed into the |
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Signed-off-by: Patrik Stas <[email protected]>
Is addressing #582
changes:
VcxError
defined inaries-vcx
, this was used by botharies-vcx
andlibvcx
. Becauselibvcx
maps needs to map error types to u32, encoding them for FFI interface, this was part ofaries-vcx
- but obivously shouldn't. So to fix this:aries-vcx
still definedVcxError
, but stripped of to minimum needed - mainly removedu32
mapping etc.libvcx
was created moduleerrors
which definesLibvcxError
which includesu32
mappingsVcxError
withLibvcxError
, there's mappingimpl From<VcxErrorKind> for LibvcxErrorKind
inmapping_from_ariesvcx.rs
errors.rs
files has also been broken down into smaller pieces, typically into files such aserrors/mapping_from_<crate>
which maps errors from<crate>
to domain errors of the given crate (such asmapping_from_ariesvcx.rs
mentioned earlier)src/errors
api_c
contained more logic than they should - the logic has been moved toapi_handle
layer instead (for example the entire fileapi_handle/wallet.rs
has been extracted from code inapi_c
and shifted layer down, towallet.rs
). This is good step to separateapi_handle
andapi_c
into separate crates Split libvcx crate #700LibvcxErrorKind
are associated - there's static vector of(LibvcxErrorKind, u32)
tuples. This way, adding new error code is minimal effort, as this would be the only single place where mapping is handled - as opposed to previously definedKind->u32
andu32->Kind
mapping declarations, which was quite error prone.ErrorLibvcx
,ErrorLibvcx
ErrorAriesVcx
,ErrorKindAriesVcx
ErrorMessages
,ErrorKindMessages
ErrorAgencyClient
,ErrorKindAgencyClient