Skip to content

Commit

Permalink
Map error in parse_response
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 f9f6c47 commit e3f5a2a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion indy_ledger_response_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,12 @@ impl ResponseParser {
where
T: DeserializeOwned + ReplyType + ::std::fmt::Debug,
{
let message: Message<T> = serde_json::from_str(response)?;
// TODO: Distinguish between not found and unexpected response format
let message: Message<T> = serde_json::from_str(response).map_err(|_| {
LedgerResponseParserError::LedgerItemNotFound(
"Structure doesn't correspond to type. Most probably not found",
)
})?;

match message {
Message::Reject(response) | Message::ReqNACK(response) => {
Expand Down

0 comments on commit e3f5a2a

Please sign in to comment.