unhandledrejection not working in Chrome unhandledrejection not working in Chrome google-chrome google-chrome

unhandledrejection not working in Chrome


As best as I can tell, the cause is that "unhandledrejection" event handlers are silently ignored if they originate from a different script origin. (For more info, see MDN on same-origin policy.) Chrome is very strict with file URLs' security origins in particular, but I've found that unknowingly breaking the same origin policy can happen for other reasons too (such as developing in webpack-dev-server with Chrome Dev Tools open). See this Chrome issue for discussion.

A workaround is to test in a simpler, closer-to-production environment: running over a plain HTTP server (SimpleHTTPServer works well), with Dev Tools closed if necessary.