-
-
Save kossnocorp/4008fdb47558dc79762792ad1faf6804 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var errorsStash = [] | |
var errorListener = function(e) { | |
errorsStash.push(e.error) | |
} | |
var unhandledRejectionListener = function(e) { | |
errorsStash.push(e.reason) | |
} | |
window.addEventListener('error', errorListener) | |
window.addEventListener('unhandledrejection', unhandledRejectionListener) | |
window.__passOnToSentry__ = function() { | |
delete window.__passOnToSentry__ | |
window.removeEventListener('error', errorListener) | |
window.removeEventListener('unhandledrejection', unhandledRejectionListener) | |
return errorsStash | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://browser.sentry-cdn.com/5.15.5/bundle.min.js" integrity="xyz" crossorigin="anonymous"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sentry.init({ dsn: 'https://[email protected]/zzz' }); | |
var errors = window.__passOnToSentry__() | |
for (var i = 0; i < errors.length; i++) { | |
Sentry.captureException(errors[i]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment