Defines the contract for components capable of analyzing exceptions and producing structured diagnostic information.
Implementations of ExceptionDiagnoser inspect an Exception and return an
ExceptionDiagnosis that may include:
- A human-readable explanation of the failure
- A recommended action or remediation step
- The original exception as the underlying cause
This interface enables pluggable, extensible, and testable diagnostic mechanisms. It is commonly used in systems where exceptions must be enriched with contextual metadata before being logged, displayed, or forwarded.
Example
class SimpleDiagnoser implements ExceptionDiagnoser {
@override
ExceptionDiagnosis diagnose(Exception exception) {
return ExceptionDiagnosis(
cause: exception,
description: "An unexpected error occurred.",
action: "Check logs for more details.",
);
}
}
Accepts no-arg constructor or a constructor with any of these parameter types:
- ApplicationContext
PodFactoryEnvironment
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
diagnose(
Exception exception) → ExceptionDiagnosis? - Produces an ExceptionDiagnosis describing the given exception.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited