mperdeck / jsnlog.js

Tiny JavaScript logging library, simple and well documented. Lots of options to filter logging data.
js.jsnlog.com
Other
130 stars 44 forks source link

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

Closed szh closed 7 years ago

szh commented 7 years ago

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 7 years ago

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

mperdeck commented 7 years ago

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.