bugsnag / bugsnag-node

[DEPRECATED] Please upgrade to our Universal JS notifier "@bugsnag/js" • https://github.com/bugsnag/bugsnag-js
https://www.bugsnag.com/
MIT License
48 stars 55 forks source link

Handled/unhandled payload properties #116

Closed bengourley closed 7 years ago

bengourley commented 7 years ago

Note this PR is based off of #115 since that is one of the main cases which requires unhandled info.

In order to support the upcoming handled/unhandled product feature this PR ensures that the following properties are set in the events[] property of the payload:

Since these properties are meant to be inferred and set internally by the notifier, but all internal usage went via Bugsnag.notify(), I extracted the contents of that function into one that is private (ie. within this module's scope only). The private function contains an additional argument handledState which cannot be set by the user, and when the public Bugsnag.notify() is called, values are inferred for handledState based on what was supplied.

There are a couple grey areas where functionality provided by this module is appeared at first to be "unhandled" and needed a severityReason etc.: Bugsnag.intercept(), Bugsnag.autoNotify(). In these instances, the captured errors are reported to via Bugsnag.notify() and therefore get handledState values applied as if the user had called the public function themselves.

(N.B. the Bugsnag.autoNotify() function is subtly different to the autoNotify option. Uncaught exceptions/promises will be reported as unhandled=true with severity="error" and the relevant severityReason.)

coveralls commented 7 years ago

Coverage Status

Coverage increased (+3.5%) to 78.762% when pulling 3d97df2f1bca6e6b4549edf84a89d7b56faf1d25 on handled-unhandled into a4bfebab0c4958b7da080c17e36e2d482a097a65 on master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+3.7%) to 78.966% when pulling c04216723873396353b09ad71641d3f28e3c49bc on handled-unhandled into a4bfebab0c4958b7da080c17e36e2d482a097a65 on master.