feat: deploy infrastructure + disk/drive, calendar, presentation, workspaces, onboarding, demo user
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
class ApiException implements Exception {
|
||||
final String message;
|
||||
final int? statusCode;
|
||||
final Map<String, dynamic>? errors;
|
||||
|
||||
ApiException(this.message, {this.statusCode, this.errors});
|
||||
|
||||
@override
|
||||
String toString() => 'ApiException($statusCode): $message';
|
||||
}
|
||||
|
||||
class UnauthorizedException extends ApiException {
|
||||
UnauthorizedException([String? message])
|
||||
: super(message ?? 'Требуется авторизация', statusCode: 401);
|
||||
}
|
||||
|
||||
class NotFoundException extends ApiException {
|
||||
NotFoundException([String? message])
|
||||
: super(message ?? 'Ресурс не найден', statusCode: 404);
|
||||
}
|
||||
|
||||
class ValidationException extends ApiException {
|
||||
ValidationException([String? message, Map<String, dynamic>? errors])
|
||||
: super(message ?? 'Ошибка валидации',
|
||||
statusCode: 422, errors: errors);
|
||||
}
|
||||
|
||||
class ServerException extends ApiException {
|
||||
ServerException([String? message])
|
||||
: super(message ?? 'Внутренняя ошибка сервера', statusCode: 500);
|
||||
}
|
||||
|
||||
class NetworkException extends ApiException {
|
||||
NetworkException([String? message])
|
||||
: super(message ?? 'Ошибка сети', statusCode: null);
|
||||
}
|
||||
|
||||
class TariffLimitException extends ApiException {
|
||||
TariffLimitException([String? message])
|
||||
: super(message ?? 'Достигнут лимит тарифа', statusCode: 403);
|
||||
}
|
||||
Reference in New Issue
Block a user