There are two approaches to global error handling in the JavaScript SDK. For a React application, it is recommended to use a component around all your code and store the errors inside a context (data storage) shown in this component. For a NodeJS application, it is recommended to use a middleware that will catch the error and highlight it.
For Cognite API related errors, we do have some documentation on that in the API reference doc (https://docs.cognite.com/api/v1/)
We have the error-boundary in place in our React-application, but it does not deal well with async-errors outside of React-code. You can in theory rethrow the error-messages and have them caught, but I couldn’t get this approach to work.
Also I would very much like not having to try-catch every single api-call we make.
I couldn’t find anything in the documentation that seemed relevant. Which part would you have me look at?
For doing global promise rejection you can use this link. This will enable you to handle all the unhandled promise rejections. When it comes to having similar functionality in the SDK, this is valuable insight as we currently do not offer such a thing.