intercom / intercom-node

Node.js bindings for the Intercom API
https://developers.intercom.com
Other
366 stars 116 forks source link

Better error handling of invalid search queries #345

Open colmdoyle opened 1 year ago

colmdoyle commented 1 year ago

See #344 for some context.

Alx101 commented 1 year ago

Just recently ran into an issue because of this. Probably due to incorrect config, but any calls from the client fails with undefined error. After some digging it seems to be getting a 404 from the api, but because of this

https://github.com/intercom/intercom-node/blob/8e4f74acd6f8f9a9498edc0df861823f55c29b12/lib/client.ts#L249 the error is swallowed and completely hidden, at least a console.error or some specific error thrown would help for debugging.

Exceptions like these need to bubble up so it can be handled properly, and give some insight into what is wrong.