ably-js
ably-js copied to clipboard
Improve debuggability of promise rejections
Quite often users are faced with unhandled promise rejection errors and are unable to figure out exactly which promise was unhandled. Some libraries offer methods for debugging this class of error, by either
- Instrumenting the promises with stack traces on creation. When an error occurs, the promise creation stack trace is included.
- Allowing a custom promise implementation, so users can instrument their own debugging.
(See: ioredis showFriendlyErrorStack https://github.com/luin/ioredis/blob/HEAD/API.md#new-commander)
We could also extend our promisify implementation to wrap callback errors with the name of the operation that is being promisified, as this will at least point people to the correct operation being unhandled correctly.