AgendaTasks/lib/core/errors/exceptions.dart
m3mo d8164be49a Add user authentication to Flutter frontend
- Create auth feature with Clean Architecture (domain/data/presentation)
- Add login and register pages with form validation
- Implement secure token storage with flutter_secure_storage
- Create AuthenticatedClient for automatic Bearer token headers
- Add AuthViewModel for global auth state management
- Update router with auth guards (redirect to login if not authenticated)
- Add logout option to settings page
- Update TaskRemoteDataSource to use authenticated client
- Add auth-related localization strings (EN/DE)
2026-02-02 22:58:07 +01:00

56 lines
1.3 KiB
Dart

class ServerException implements Exception {
final String message;
final int? statusCode;
const ServerException({required this.message, this.statusCode});
@override
String toString() => 'ServerException: $message (status: $statusCode)';
}
class NetworkException implements Exception {
final String message;
const NetworkException({this.message = 'Network connection failed'});
@override
String toString() => 'NetworkException: $message';
}
class ValidationException implements Exception {
final String message;
final Map<String, dynamic>? errors;
const ValidationException({required this.message, this.errors});
@override
String toString() => 'ValidationException: $message';
}
class NotFoundException implements Exception {
final String message;
const NotFoundException({this.message = 'Resource not found'});
@override
String toString() => 'NotFoundException: $message';
}
class AuthException implements Exception {
final String message;
const AuthException({required this.message});
@override
String toString() => 'AuthException: $message';
}
class UnauthorizedException implements Exception {
final String message;
const UnauthorizedException({this.message = 'Unauthorized'});
@override
String toString() => 'UnauthorizedException: $message';
}