I'd like to be able to inject a notifier into a package that's agnostic of this library, without losing any functionality.
Currently this is impossible because the *Notifier#Wrap() method returns a *bugsnag.Error, and although this adheres to the error interface, the compiler won't allow an error return type.
Describe how you wish this package would help you solve the problem
The *Notifier's Wrap method should return a standard library error so that packages can interface away the Bugsnag dependency if they so wish.
The package-level Wrap function can still return a *bugsnag.Error, as by definition, there's already a dependency on the Bugsnag library at that point. This way users don't have to do any type casting if they want to access the Panic or Unhandled fields on the error.
What problem are you trying to solve?
I'd like to be able to inject a notifier into a package that's agnostic of this library, without losing any functionality.
Currently this is impossible because the
*Notifier#Wrap()
method returns a*bugsnag.Error
, and although this adheres to theerror
interface, the compiler won't allow anerror
return type.Describe how you wish this package would help you solve the problem
The
*Notifier
'sWrap
method should return a standard libraryerror
so that packages caninterface
away the Bugsnag dependency if they so wish.The package-level
Wrap
function can still return a*bugsnag.Error
, as by definition, there's already a dependency on the Bugsnag library at that point. This way users don't have to do any type casting if they want to access thePanic
orUnhandled
fields on the error.