mperdeck/jsnlog.js

Cannot read property 'message' of undefined in `onunhandledrejection`

szh opened this issue · 2 comments

szh commented

In the latest version of jsnlog with the new onunhandledrejection handler, I'm getting an error:

Uncaught TypeError: Cannot read property 'message' of undefined
at window.onunhandledrejection (jsnlog.js:829)

The error is here in the code and is caused b/c event.reason is undefined. Maybe it should be
"errorMsg": event.reason ? event.reason.message : null?

Thanks for the great library and all your hard work!

szh commented

Also, there doesn't seem to be an option to disable the onunhandledrejection handler. Are there plans to add this?

Thanks for your bug report. The fix will go into the next release 2.22.1.

There are no plans to add functionality to disable the onunhandledrejection handler. However, I guess you already could do this yourself by setting an empty onunhandledrejection handler. You will have seen that if there already is an onunhandledrejection handler, it won't override it.