avadev/AvaTax-REST-V2-JS-SDK

Return response status

lulusjhos opened this issue · 2 comments

In Avalara documentation says:
...AvaTax API call produces an error, it responds using the standard HTTP error response codes

  • 400-499 Client errors
  • 500-599 Server errors

Avalara Doc: Handling Error Messages

But we can not get the response status since Avalara is returning response.json(), so the subsequent then and catch only get the result of response.json() which is the body of the response. Therefore the response status is not visible in the second then

return res.json();

Just saw this. I think the root of the issue is the regression in error handling: #210

That won't expose the underlying response code, but at least you'd be able to catch the error and see its error.code.

Thanks for the feedback. The issue has been fixed as part of 22.2.1 release.
Thanks.