AuthException class

Exception thrown for authentication-related errors

This exception is used throughout the authentication system to indicate various authentication failures such as invalid credentials, expired tokens, missing permissions, etc.

It extends the base AppException and provides specific status codes appropriate for authentication errors (typically 401 Unauthorized).

Example usage:

// Throwing an auth exception
throw AuthException('Invalid credentials provided');

// With custom status code
throw AuthException('Token expired', statusCode: 401);

// With stack trace for debugging
throw AuthException(
  'Authentication failed',
  stackTrace: StackTrace.current.toString(),
);
Inheritance

Constructors

AuthException(String message, {int statusCode = 401, String? stackTrace})
Creates an authentication exception

Properties

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

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).
inherited
toString() String
A string representation of this object.
inherited

Operators

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