mirror of
https://github.com/Livinglist/Hacki.git
synced 2025-08-06 18:24:42 +08:00
40 lines
959 B
Dart
40 lines
959 B
Dart
typedef AppExceptionHandler = void Function(AppException);
|
|
|
|
class AppException implements Exception {
|
|
AppException({
|
|
required this.message,
|
|
this.stackTrace,
|
|
});
|
|
|
|
final String? message;
|
|
final StackTrace? stackTrace;
|
|
}
|
|
|
|
class RateLimitedException extends AppException {
|
|
RateLimitedException(this.statusCode)
|
|
: super(message: 'Rate limited ($statusCode)...');
|
|
|
|
final int? statusCode;
|
|
}
|
|
|
|
class RateLimitedWithFallbackException extends AppException {
|
|
RateLimitedWithFallbackException(this.statusCode)
|
|
: super(
|
|
message: 'Rate limited ($statusCode), fetching from API instead...',
|
|
);
|
|
|
|
final int? statusCode;
|
|
}
|
|
|
|
class PossibleParsingException extends AppException {
|
|
PossibleParsingException({
|
|
required this.itemId,
|
|
}) : super(message: 'Possible parsing failure...');
|
|
|
|
final int itemId;
|
|
}
|
|
|
|
class GenericException extends AppException {
|
|
GenericException() : super(message: 'Something went wrong...');
|
|
}
|