heiseonline / perl-sentry-sdk

Other
8 stars 6 forks source link

Sentry::SDK crashes on DBIx::Class errors #7

Closed rabbiveesh closed 2 years ago

rabbiveesh commented 2 years ago

In Sentry::Stacktrace, sentry assumes that all exceptions have a frames attribute.

For the most part this is fine, b/c all plain errors are caught by Sentry::Integration::DieHandler and turned into Mojo::Exceptions, which do provide that attribute.

However, ::DieHandler just rethrows any exceptions that are references. Thus, they may not (and in the case of DBIx::Class::Exception, do not) have that available, and Sentry::SDK crashes instead.

Not sure what the best solution is for this problem.

rabbiveesh commented 2 years ago

In my work code, i simply guarded the creation of a Sentry::Stacktrace on line 71 of Sentry::Client to objects which ->can('frames'). Not sure if that's the best solution, let me know if you want a PR

pmb0 commented 2 years ago

Thank you for all your feedback here. I followed your suggestion and added the frames check.