Ignore errors
The AppSignal configuration makes it possible to ignore errors. By providing a list of specific errors AppSignal will not send alerts when these errors are raised.Appsignal.set_error/3
If you want to rescue exceptions in your application to prevent crashes, but still want to track the occurrence you can useAppsignal.set_error/2 to add the exception to the
current AppSignal transaction:
Erlang
The AppSignal integration tries its best to convert errors raised from Erlang to Elixir exceptions. For example, a:badarg
raised from Erlang is automatically converted to an ArgumentError. However, sometimes the best it can do is wrapping the error originating from Erlang in an ErlangError.
Since these don’t give much insight into the underlying issue, we recommend adding information from within your application by catching the error, creating an Elixir exception yourself and adding that to the current span using the set_error/2 function.
On versions before 2.1.0, use catch and Appsignal.send_error/3:
send_error, but still want to report the scenario as an error, it’s also possible to initialize a custom error struct.
Appsignal.send_error/3 for sending errors
without an AppSignal transaction.
Appsignal.send_error/3
AppSignal provides a mechanism to track errors that occur in code that’s not in a web or background job context, such as Mix tasks. This is useful for instrumentation that doesn’t automatically create AppSignal transactions to profile. You can use theAppsignal.send_error/3 function to
directly send an exception to AppSignal from any place in your code without
starting an AppSignal transaction first.
send_error, but still want to report the scenario as an error, it’s also possible to initialize a custom error struct.
Additional metadata
To add metadata to the sent error, pass a function as the fourth argument toAppsignal.send_errror/4: