You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			30 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			30 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Dart
		
	
import 'dart:convert';
 | 
						|
 | 
						|
import 'package:mohem_flutter_app/api/api_client.dart';
 | 
						|
 | 
						|
class APIException implements Exception {
 | 
						|
  static const String BAD_REQUEST = 'api_common_bad_request';
 | 
						|
  static const String UNAUTHORIZED = 'api_common_unauthorized';
 | 
						|
  static const String FORBIDDEN = 'api_common_forbidden';
 | 
						|
  static const String NOT_FOUND = 'api_common_not_found';
 | 
						|
  static const String INTERNAL_SERVER_ERROR = 'api_common_internal_server_error';
 | 
						|
  static const String UPGRADE_REQUIRED = 'api_common_upgrade_required';
 | 
						|
  static const String BAD_RESPONSE_FORMAT = 'api_common_bad_response_format';
 | 
						|
  static const String OTHER = 'api_common_http_error';
 | 
						|
  static const String TIMEOUT = 'api_common_http_timeout';
 | 
						|
  static const String UNKNOWN = 'unexpected_error';
 | 
						|
 | 
						|
  final String message;
 | 
						|
  final APIError? error;
 | 
						|
  final arguments;
 | 
						|
 | 
						|
  const APIException(this.message, {this.arguments, this.error});
 | 
						|
 | 
						|
  Map<String, dynamic> toJson() => {'message': message, 'error': error, 'arguments': '$arguments'};
 | 
						|
 | 
						|
  @override
 | 
						|
  String toString() {
 | 
						|
    return jsonEncode(this);
 | 
						|
  }
 | 
						|
}
 |