Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: application crash when timeout encountered (#569)
I encountered occasional application crashes and traced them back to timeouts coming from the Nylas API. After reviewing the Nylas-SDK, I found the culprit in the `setTimeout` call used to abort the request. It's bad practice to throw an error from `setTimeout` as its `try...catch` blocks will not intercept the error. Instead, these errors will crash the application. `node-fetch` will reject when `controller.abort()` is called, so we don't need to throw from the timeout anyway. Reference: https://jaketrent.com/post/catch-error-thrown-settimeout/ https://nodejs.org/dist/latest-v7.x/docs/api/errors.html#errors_node_js_style_callbacks
- Loading branch information