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.Exception handling
Simply ignoring an error will silence notifications, but could potentially hide a bigger problem. For this reason we recommend you add exception handling withtry ... except statements to your application.
Using try ... except you can catch specific exceptions and add an alternative code path for when an exception occurs, such as rendering 404 pages or providing the user with more detailed error messages about what went wrong.
For example, in a Django view file we can do the following:
set_error or send_error helpers.
set_error
Report errors, without having them crash your application. Using theset_error helper, the given error is set on the AppSignal trace, which reports the error on the trace (request / background job) to AppSignal.
If you still want to track the error while catching it, you can use the set_error helper to add the exception to the current AppSignal trace. The error will be recorded in AppSignal, but your process will not crash.
For example, in a Django view file we can do the following:
send_error
AppSignal provides a mechanism to send errors to AppSignal without having to start a trace. This is useful for tracking errors that occur in code that’s not in a web request or background job context, such as one off scripts or cron jobs. This is useful for apps that do not use our instrumentations for this part of the app in which the error is raised. You can use thesend_error method to directly send an exception to AppSignal from any place in your code without starting a trace first.
Additional metadata
To add metadata to the sent error, use thesend_error_with_context method. Tags and other types of data customization can be added to the error this way.