Skip to content

Commit

Permalink
refactor: appending inner error (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierobassa authored Nov 27, 2023
1 parent 095661f commit a64f364
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
10 changes: 9 additions & 1 deletion packages/core/src/keystore/keystore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ async function decrypt(
password
)) as KeystoreAccount;
} catch (e) {
throw buildError(KEYSTORE.INVALID_PASSWORD, 'Invalid password');
throw buildError(
KEYSTORE.INVALID_PASSWORD,
'Invalid password',
{
keystore,
password
},
e
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class TransactionsClient {
throw buildError(
DATA.INVALID_DATA_TYPE,
'Invalid raw transaction given as input. Input must be a valid raw transaction. Error occurs while decoding the transaction.',
{ raw }
{ raw },
error
);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/network/src/utils/http/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class HttpClient {
// If it's not an Axios error, re-throw the original error
throw buildError(
HTTP_CLIENT.INVALID_HTTP_REQUEST,
`An error occurred while performing http request ${JSON.stringify(
err
)}`
`An error occurred while performing http request`,
{ method, path, params },
err
);
}
}
Expand Down

1 comment on commit a64f364

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 100%
100% (1094/1094) 100% (261/261) 100% (218/218)
Title Tests Skipped Failures Errors Time
core 319 0 💤 0 ❌ 0 🔥 1m 32s ⏱️
network 71 0 💤 0 ❌ 0 🔥 54.117s ⏱️
errors 30 0 💤 0 ❌ 0 🔥 11.58s ⏱️

Please sign in to comment.