[Bug] SDK not returning any errorcodes
Closed this issue · 2 comments
merajcodes commented
The bug
according to the docs I am supposed to get an ErrorCode whenever something goes wrong. Instead I only get the HTTP status code ex.400 in the status l like so:
{ "message":"Request failed with status code 400", "name":"AxiosError", "config":{ ... }, "code":"ERR_BAD_REQUEST", "status":400 }
This makes catching errors very difficult.
My code
try{ const depositAddresses = await fireblocks.getDepositAddresses(vId, aId); } catch(error){ return res.status(500).json({ 'error':JSON.stringify(error) }); }
Version:
fireblocks-sdk
version: 3.1.3
yarinvak commented
Hey, the SDK throws an AxiosError
The error itself contains the field .response
So getting the error code will be via:
error.response.data.code
merajcodes commented
This is working thank you!