BaseException class abstract

Base class all domain exceptions should extend.

  • Immutable: all fields are final and metadata is wrapped in an unmodifiable view to prevent mutation.
  • Comparable: implements Equatable for consistent comparisons in tests/state.
  • Severity-aware: integrates with the reporting policy via severity.
Implemented types
Implementers
Annotations

Constructors

BaseException({required String userMessage, required String devMessage, Object? cause, StackTrace? stack, Map<String, dynamic> metadata = const {}, Severity severity = Severity.error, bool isReportable = true})
Creates a base exception with immutable metadata and derived stack trace.

Properties

cause Object?
Original underlying error, if any.
final
devMessage String
Developer-friendly details, safe for logs and tools.
final
hashCode int
The hash code for this object.
no setterinherited
isReportable bool
Whether this exception should be reported automatically.
final
metadata Map<String, dynamic>
Additional diagnostic data related to this exception.
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
severity Severity
How serious this exception is.
final
stack StackTrace?
Capture location. Defaults to StackTrace.current when not provided.
final
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
userMessage String
Human-friendly text appropriate for end-users.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.

Operators

operator ==(Object other) bool
The equality operator.
inherited