22 lines
571 B
Dart
22 lines
571 B
Dart
class AppException implements Exception {
|
|
final String message;
|
|
final String prefix;
|
|
|
|
AppException([this.message = 'An unknown error occurred.', this.prefix = '']);
|
|
|
|
@override
|
|
String toString() {
|
|
return '$prefix$message';
|
|
}
|
|
}
|
|
|
|
class FetchDataException extends AppException {
|
|
FetchDataException([String? message])
|
|
: super(message ?? 'Error During Communication: ', 'Network Error');
|
|
}
|
|
|
|
class AuthenticationException extends AppException {
|
|
AuthenticationException([String? message])
|
|
: super(message ?? 'Authentication Failed.', 'Auth Error');
|
|
}
|