pub trait ProblemReporter {
    fn capture_error_context(
        &'static self,
        report: &mut Report,
        error: &(dyn Error + 'static)
    ); fn should_report_error(&'static self, problem: &Problem) -> bool; fn report_error(&'static self, problem: &Problem); }
Expand description

A type responsible for capturing and report Problem errors.

The crate doesn’t provide a default implementation of this trait, as how you report your service’s errors depends on your infrastructure.

Required Methods

Capture extra information about the error context and saves it inside the given report.

Note that this will be called even for client-related errors, like NotFound or UnprocessableEntity, during the error creation (this is why we don’t pass a Problem instance here). So try to be conservative on what you do in this method to prevent making error handling an expensive operation.

Says if we should report the error or not.

Reports the error.

This will only be called if ProblemReporter::should_report_error returns true.

Implementors