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:
unhandled
defaultSeverity
severityReason
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.)
Coverage increased (+3.5%) to 78.762% when pulling 3d97df2f1bca6e6b4549edf84a89d7b56faf1d25 on handled-unhandled into a4bfebab0c4958b7da080c17e36e2d482a097a65 on master.
Coverage increased (+3.7%) to 78.966% when pulling c04216723873396353b09ad71641d3f28e3c49bc on handled-unhandled into a4bfebab0c4958b7da080c17e36e2d482a097a65 on master.
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:unhandled
defaultSeverity
severityReason
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 argumenthandledState
which cannot be set by the user, and when the publicBugsnag.notify()
is called, values are inferred forhandledState
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 viaBugsnag.notify()
and therefore gethandledState
values applied as if the user had called the public function themselves.(N.B. the
Bugsnag.autoNotify()
function is subtly different to theautoNotify
option. Uncaught exceptions/promises will be reported asunhandled=true
withseverity="error"
and the relevantseverityReason
.)