When an exception occurs, and the stacktrace includes a core JavaScript API, the exception-reporting package fails to report the exception to bugsnag. For example, the stacktrace below involves an exception in the fuzzy-finder package, and the stacktrace includes a call to Array.forEach:
~/github/fuzzy-finder/lib/main.js:81 Uncaught Error
at forEach (/Users/j/github/fuzzy-finder/lib/main.js:81:31)
===> at Array.forEach (native) <===
at Object.createProjectView (/Users/j/github/fuzzy-finder/lib/main.js:81:9)
at HTMLElement.fuzzy-finder:toggle-file-finder (/Users/j/github/fuzzy-finder/lib/main.js:12:14)
at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:384:49)
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:110:40)
When the exception-reporting package attempts to normalize the paths in the stacktrace, the package errors when it encounters Array.forEach in the stacktrace. Instead of reporting the exception to bugsnag, the package logs an error to the console:
Error reporting uncaught exception TypeError: Cannot read property 'replace' of null
at Reporter.normalizePath (~/github/exception-reporting/lib/reporter.js:71:27)
at Reporter.scrubPath (~/github/exception-reporting/lib/reporter.js:77:31)
at ~/github/exception-reporting/lib/reporter.js:61:20
at Array.map (native)
at Reporter.buildStackTraceJSON (~/github/exception-reporting/lib/reporter.js:59:40)
at Reporter.buildExceptionJSON (~/github/exception-reporting/lib/reporter.js:54:24)
at Reporter.buildNotificationJSON (~/github/exception-reporting/lib/reporter.js:33:27)
at Reporter.reportUncaughtException (~/github/exception-reporting/lib/reporter.js:229:30)
at ~/github/atom/out/app/node_modules/exception-reporting/lib/main.js:25:23
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:20)
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:34)
at window.onerror (/Applications/Atom.app/Contents/Resources/app/src/atom-environment.js:949:26)
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:110:40)
Steps to Reproduce
Clone the repository for another bundled package and apm link it. We'll use fuzzy-finder for this example:
git clone atom/fuzzy-finder
cd fuzzy-finder
git checkout v1.8.1
apm install && apm link
In the fuzzy-finder code, edit main.js to trigger an error that has a core JavaScript API in the stacktrace:
Clone the atom/exception-reporting repository and apm link the package:
git clone atom/exception-reporting
cd exception-reporting
git checkout v0.43.1
apm install && apm link
In the exception-reporting code, edit lib/reporter.js so that it will treat our local copy of fuzzy-finder as a bundled package for error reporting purposes:
Description
When an exception occurs, and the stacktrace includes a core JavaScript API, the exception-reporting package fails to report the exception to bugsnag. For example, the stacktrace below involves an exception in the fuzzy-finder package, and the stacktrace includes a call to
Array.forEach
:When the exception-reporting package attempts to normalize the paths in the stacktrace, the package errors when it encounters
Array.forEach
in the stacktrace. Instead of reporting the exception to bugsnag, the package logs an error to the console:Steps to Reproduce
apm link
it. We'll use fuzzy-finder for this example:git clone atom/fuzzy-finder
cd fuzzy-finder
git checkout v1.8.1
apm install && apm link
In the fuzzy-finder code, edit
main.js
to trigger an error that has a core JavaScript API in the stacktrace:apm link
the package:git clone atom/exception-reporting
cd exception-reporting
git checkout v0.43.1
apm install && apm link
In the exception-reporting code, edit
lib/reporter.js
so that it will treat our local copy of fuzzy-finder as a bundled package for error reporting purposes:Fuzzy Finder: Toggle File Finder
command to force the error above to be thrownExpected behavior: Error should be successfully posted to bugsnag
Actual behavior: Error is not reported to bugsnag
Reproduces how often: 100%
Versions
exception-reporting 0.43.1
/cc @as-cii (since we encountered this issue while pairing today)