Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
server_exception.dart
Go to the documentation of this file.
1import 'app_exception.dart';
2
3class ServerException extends AppException {
5 required super.message,
6 super.code,
7 super.details,
8 });
9
10 factory ServerException.fromStatus(int statusCode) {
11 switch (statusCode) {
12 case 400:
13 return const ServerException(
14 message: 'Bad request',
15 code: 'SERVER_400',
16 );
17 case 401:
18 return const ServerException(
19 message: 'Unauthorized',
20 code: 'SERVER_401',
21 );
22 case 403:
23 return const ServerException(
24 message: 'Forbidden',
25 code: 'SERVER_403',
26 );
27 case 404:
28 return const ServerException(
29 message: 'Not found',
30 code: 'SERVER_404',
31 );
32 case 500:
33 return const ServerException(
34 message: 'Internal server error',
35 code: 'SERVER_500',
36 );
37 case 503:
38 return const ServerException(
39 message: 'Service unavailable',
40 code: 'SERVER_503',
41 );
42 default:
43 return ServerException(
44 message: 'Server error',
45 code: 'SERVER_$statusCode',
46 );
47 }
48 }
49}
const ServerException({ required super.message, super.code, super.details, })
final String message
Definition failures.dart:0