This commit is contained in:
2025-09-26 18:48:14 +07:00
parent 382a0e7909
commit 30ed6b39b5
85 changed files with 20722 additions and 112 deletions

View File

@@ -0,0 +1,79 @@
/// Base exception class for the application
abstract class AppException implements Exception {
final String message;
final String? code;
final dynamic originalError;
const AppException(
this.message, {
this.code,
this.originalError,
});
@override
String toString() {
return 'AppException: $message${code != null ? ' (Code: $code)' : ''}';
}
}
/// Network-related exceptions
class NetworkException extends AppException {
const NetworkException(
super.message, {
super.code,
super.originalError,
});
}
/// Cache-related exceptions
class CacheException extends AppException {
const CacheException(
super.message, {
super.code,
super.originalError,
});
}
/// Validation-related exceptions
class ValidationException extends AppException {
const ValidationException(
super.message, {
super.code,
super.originalError,
});
}
/// Authentication-related exceptions
class AuthException extends AppException {
const AuthException(
super.message, {
super.code,
super.originalError,
});
}
/// Server-related exceptions
class ServerException extends AppException {
final int? statusCode;
const ServerException(
super.message, {
this.statusCode,
super.code,
super.originalError,
});
@override
String toString() {
return 'ServerException: $message${statusCode != null ? ' (Status: $statusCode)' : ''}${code != null ? ' (Code: $code)' : ''}';
}
}
/// Local storage exceptions
class StorageException extends AppException {
const StorageException(
super.message, {
super.code,
super.originalError,
});
}