Skip to main content
Use this API to listen for unhandled Promise rejections. The callback triggers when a Promise without a rejection handler is rejected.

Parameters

Callback Parameters

Return Value

my.onUnhandledRejection(callback) returns a listener object. Call its remove() method to stop listening.

Code Example

Basic Usage

Error Logging

Development Debugging

Common Causes

Unhandled Promise rejections typically occur when:
Always add .catch() handlers to your Promises or use try/catch with async/await to prevent unhandled rejections.

my.offUnhandledRejection

Stop listening for unhandled rejections

my.onError

Listen for JS errors