titanium-sdk icon indicating copy to clipboard operation
titanium-sdk copied to clipboard

Android: Add support for onunhandledrejection event

Open jonasfunk opened this issue 1 year ago • 1 comments

I have searched and made sure there are no existing issues for the issue I am filing

  • [X] I have searched the existing issues

Description

If a JavaScript promise that has no rejection handler is rejected, the unhandledrejection event is sent to the global scope. Handling unhandledrejection event is currently only supported for iOS, but should be supported on Android as well, as this is useful for debugging and for providing fallback error handling for unexpected situations.

Solution

//Add support for this on Android
global['onunhandledrejection'] = function(reason, promise){
    
}

Alternatives

No response

Platforms

Android

jonasfunk avatar Aug 22 '22 08:08 jonasfunk

A small addition: there is an old jira ticket with some infos and an example: https://jira-archive.titaniumsdk.com/TIMOB/TIMOB-27926 Might be useful

m1ga avatar Aug 22 '22 11:08 m1ga