Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Throw errors in dev to make debugging easier
Browse files Browse the repository at this point in the history
  • Loading branch information
Giancarlo Anemone committed Jan 31, 2018
1 parent a43ceab commit 94cb2e4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ export default __BROWSER__ &&
createPlugin({
deps: {emit: ErrorHandlingEmitterToken},
provides: ({emit}) => {
const _emit =
(typeof emit === 'function' && emit) ||
let _emit =
emit ||
((e, src) => {
if (window.onerror) window.onerror(e.message, src, null, null, e);
});
if (__DEV__) {
let oldEmit = _emit;
_emit = (e, src) => {
oldEmit(e, src);
throw e;
};
}
for (const key in window) {
if (
key.match(/webkit/) == null && // stop deprecation warnings
Expand Down

0 comments on commit 94cb2e4

Please sign in to comment.