We’re working on a Creator Project that will be exporting to web. We were hoping to be able to track our errors with a service like Bugsnag. However I can’t seem to find a way to report the unhandled errors. I tried using the onerror functions and listening for error events as set out here:
But unfortunately, these do not seem to report errors made in the Creator code. I have set up a error in a main class:
this.foo = void 0;
this.foo.bar();
This does not reach the two error handlers I mentioned. If anyone knows what I’m missing, or if there’s a hook within creator that I can attach to, it would be greatly appreciated. Thanks!
Edit: Doing some more digging, it seems like it may be related to Promises somehow.
typescript.js:35 Uncaught (in promise) Error: This here be a test error, for those of you listening
at Login.<anonymous> (project.dev.js:3361)
at step (typescript.js:64)
at Object.next (typescript.js:45)
at typescript.js:39
at Promise (<anonymous>)
at 316.window.__awaiter (typescript.js:35)
at Login.onLoad (project.dev.js:3358)
at CCClass.eval [as _invoke] (eval at createInvokeImpl (component-scheduler.js:239), <anonymous>:3:65)
at CCClass.invoke (component-scheduler.js:137)
at CCClass.activateNode (node-activator.js:196)
This error does not seem to get recorded. But I’m not sure where else I would grab it, so that it could be forwarded to the reporter.
Host built files on web server. And Browse index.html
Error will be happened like this:
project.js:1 Uncaught TypeError: Cannot read property 'bar' of undefined
at o.onLoad (project.js:1)
at Object.eval [as _invoke] (eval at o (cocos2d-js-min.js:9), <anonymous>:3:65)
at Object.invoke (cocos2d-js-min.js:9)
at Object.activateNode (cocos2d-js-min.js:17)
at Object._activate (cocos2d-js-min.js:7)
at e.runSceneImmediate (cocos2d-js-min.js:5)
at cocos2d-js-min.js:5
at s.<anonymous> (cocos2d-js-min.js:18)
at cocos2d-js-min.js:16
at cocos2d-js-min.js:21
However, I can’t catch errors in production enviroment becuase of Cross-Origin settings :’-(