Skip to content

Commit

Permalink
Add error type conversions to aries-vcx-core
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Kovar <[email protected]>
  • Loading branch information
mirgee committed Aug 11, 2023
1 parent 264e3ad commit f9f6c47
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions aries_vcx_core/src/errors/mapping_ledger_response_parser.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use indy_ledger_response_parser::error::LedgerResponseParserError;

use super::error::{AriesVcxCoreError, AriesVcxCoreErrorKind};

impl From<LedgerResponseParserError> for AriesVcxCoreError {
fn from(err: LedgerResponseParserError) -> Self {
match &err {
LedgerResponseParserError::JsonError(err) => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::InvalidJson, err.to_string())
}
LedgerResponseParserError::LedgerItemNotFound(item) => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::LedgerItemNotFound, err.to_string())
}
LedgerResponseParserError::InvalidTransaction(message) => {
AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::InvalidLedgerResponse, err.to_string())
}
}
}
}
1 change: 1 addition & 0 deletions aries_vcx_core/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ mod mapping_indy_api_types;
mod mapping_indyvdr;
#[cfg(feature = "vdr_proxy_ledger")]
mod mapping_indyvdr_proxy;
mod mapping_ledger_response_parser;
mod mapping_others;
1 change: 1 addition & 0 deletions indy_ledger_response_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extern crate serde;
extern crate serde_json;

mod domain;
pub mod error;

pub use domain::author_agreement::GetTxnAuthorAgreementData;
use domain::author_agreement::GetTxnAuthorAgreementResult;
Expand Down

0 comments on commit f9f6c47

Please sign in to comment.