avadev/AvaTax-REST-V2-JS-SDK

Error handling regressed

oleg-codaio opened this issue · 1 comments

It looks like version 21.12.0 of this library completely regressed error handling. It was working fine before:

// handle error
if (json.error) {
let ex = new Error(json.error.message);

But someone decided it would be a good idea to add a length check:

// handle error
if (json && json.length>0 && json.error) {
let ex = new Error(json.error.message);

Of course, the response isn't guaranteed to be an array - it might just be a single top-level object, as is the case for what's returned by getTransactionByCode:

image

Solution for now is to pin to 21.10.0 but this seems like a pretty careless release.

@oleg-codaio Thanks for the feedback. The issue has been fixed as part of 22.2.1 release.
Thanks.