feat (android): global UnhandledRejection redirector to JSDialogError and uncaughtException handler#14182
feat (android): global UnhandledRejection redirector to JSDialogError and uncaughtException handler#14182Informate wants to merge 25 commits intotidev:mainfrom
Conversation
|
Please check https://www.fromzerotoapp.com/extending-titanium-sdk/#link9 and rename the title according to it. This should be a |
Renamed! There something more I have to do? Need to resubmit the PR or not? |
|
@Informate no, you don't need to resubmit it. Please add the code example to the first post (edit it) so people know how to test it. |
Done |
m1ga
left a comment
There was a problem hiding this comment.
Functional test:
- current master will not show an error with the provided demo code
- this PR will show
[ERROR] V8Util: Uncaught Error: Show me this ERROR !!!!
[ERROR] V8Util: /alloy/controllers/index.js @ 48 >>> throw new Error("Show me this ERROR !!!!");
[ERROR] TiExceptionHandler: (main) [49,49] /alloy/controllers/index.js:48
[ERROR] TiExceptionHandler: throw new Error("Show me this ERROR !!!!");
[ERROR] TiExceptionHandler: ^
[ERROR] TiExceptionHandler: Error: Show me this ERROR !!!!
[ERROR] TiExceptionHandler: at /alloy/controllers/index.js:48:7
[ERROR] TiExceptionHandler: at new Controller (/alloy/controllers/index.js:49:3)
[ERROR] TiExceptionHandler: at Object.exports.createController (/alloy.js:427:8)
[ERROR] TiExceptionHandler: at /app.js:32:7
[ERROR] TiExceptionHandler: at Module._runScript (ti:/kroll.js:1196:15)
[ERROR] TiExceptionHandler: at Module.load (ti:/kroll.js:734:13)
[ERROR] TiExceptionHandler: at Module.loadJavascriptText (ti:/kroll.js:1062:15)
[ERROR] TiExceptionHandler: at Module.loadAsFile (ti:/kroll.js:1108:22)
[ERROR] TiExceptionHandler: at Module.loadAsFileOrDirectory (ti:/kroll.js:1039:26)
[ERROR] TiExceptionHandler: at Module.require (ti:/kroll.js:865:30)
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
[ERROR] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:172)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiApplication.launch(TiApplication.java:881)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:96)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:508)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:177)
[ERROR] TiExceptionHandler: org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:527)
[ERROR] TiExceptionHandler: android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1717)
[ERROR] TiExceptionHandler: android.app.Activity.performResume(Activity.java:9315)
[ERROR] TiExceptionHandler: android.app.ActivityThread.performResumeActivity(ActivityThread.java:5605)
as an error log and the error message in the event has more infos like the stack and stacktrace.
GitHub Issues: #14177
Optional Description:
The unhandledRejection V8 event is unhandled by Titanium SDK at the moment, and the unhandledRejections event get silently lost.
This commit fixes the issue handling the V8 event and sending it from V8Runtime to the JS environment thorw Kroll with just few changes and modify.
The JS Error Dialog shows correctly and the Rejected Promises can now be cacthed by uncaughtException as an exception with type='Rejected Promise' (still not a Ti.App unhandledRejection event).
Code Example: