Skip to content

Commit

Permalink
update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
brendan-defi committed Jan 28, 2025
1 parent 79f148e commit da57f9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api/buildSendTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('buildSendTransaction', () => {
expect(result).toMatchObject({
code: 'AmBSeTa01',
message: 'Could not build transfer transaction',
error: expect.stringContaining('Error'),
error: expect.any(String),
});
});
});
3 changes: 2 additions & 1 deletion src/api/buildSendTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export function buildSendTransaction({
data: transferCallData,
};
} catch (error) {
const message = error instanceof Error ? error.message : `${String(error)}`;
return {
code: 'AmBSeTa01', // Api Module Build Send Transaction Error 01
error: `Error: ${error}`,
error: message,
message: 'Could not build transfer transaction',
};
}
Expand Down

0 comments on commit da57f9f

Please sign in to comment.