Skip to main content
Use this API to listen for JavaScript errors that occur during Mini Program execution. This allows you to implement custom error handling and logging strategies.

Parameters

Callback Parameters

Code Example

Basic Error Handling

Error Logging Service

Page-Level Error Handling

Use Cases

The my.onError callback triggers at the same time as the onError() method in app registration, with the same parameters.
Currently, this API only captures JavaScript errors. Native errors and other types of exceptions may not be captured.

my.offError

Stop listening for error events

my.onUnhandledRejection

Listen for unhandled Promise rejections