When using the FreshBooks client to make a request in the form of client.projects.list(businessId), the function call throws a TypeError when the access token is expired, instead of returning an http 401 error in the form described in the docs
How to reproduce
Create new client using a pre-generated access token that is expired or invalid
List all projects using the .projects.list() function
Throws runtime exception: TypeError: Cannot destructure property 'total' of 'meta' as it is undefined. The stack trace seems to point to the axios library
When using the FreshBooks client to make a request in the form of
client.projects.list(businessId)
, the function call throws a TypeError when the access token is expired, instead of returning an http 401 error in the form described in the docsHow to reproduce
.projects.list()
functionTypeError: Cannot destructure property 'total' of 'meta' as it is undefined.
The stack trace seems to point to the axios librarySee this repo for a working example of this issue
Expected behavior
Calling this function should return an HTTP 401 Unauthorized response and an error as described in the docs: