AppException class abstract

Base class for custom application exceptions.

Extend this class to create specific error types with custom messages, status codes, and optional error details.

Example:

class UnauthorizedException extends AppException {
  UnauthorizedException() : super('Unauthorized', statusCode: 401);
}
Implemented types
Implementers

Constructors

AppException(String message, {int statusCode = 500, String type = 'about:blank', String title = 'Application Error', String? instance, dynamic details})

Properties

details → dynamic
Optional additional information for debugging.
final
hashCode int
The hash code for this object.
no setterinherited
instance String?
A URI reference that identifies the specific occurrence of the problem.
final
message String
Human-readable error message (detail).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
HTTP-like status code (defaults to 500).
final
title String
A short, human-readable summary of the problem type.
final
type String
A URI reference that identifies the problem type.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toResponse() Map<String, dynamic>
Converts the exception to a serializable response map (RFC 7807).
toString() String
A string representation of this object.
override

Operators

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