Hello!

I was working with the library Quantum. It allows you to run jobs/tasks on 
a cron-like schedule (very useful tool!). However, my jobs were failing and 
I wasn't being notified about the failure.

One of the reasons this was occurring is because Sentry (error tracking 
service) relies on the `crash_reason` metadata key to report exceptions. It 
turns out transforming `{kind, reason}` available in `catch` into the 
format required for `crash_reason` is not straightforward.

I was able to find a snippet of broadway code that accomplishes this:

https://github.com/dashbitco/broadway/blob/master/lib/broadway/topology/processor_stage.ex#L165-L179

Here's the patch I submitted to Quantum to perform similar logic:

https://github.com/quantum-elixir/quantum-core/pull/464/files

I think it would be very helpful to have a way to log exceptions that are 
caught in `catch`. Something like the `log_exception` function above, maybe 
built directly into the `Logger` module as a `exception` function? I don't 
have enough familiarity with the stdlib to have a good sense of where this 
function should go, but it feels important to have an easy way to log an 
exception in a way that will be picked up by logging backends watching for 
exceptions.

Curious what folks think!

Mike

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/c89c08e5-9879-414a-b668-0377fc2ab02an%40googlegroups.com.

Reply via email to