CustomException constructor
CustomException({
- required ExceptionType type,
- String? exceptionMessage,
- String? exceptionPath,
- required DeviceInfo deviceInfo,
- required Map<
String, dynamic> userInfo, - dynamic response,
- dynamic request,
- int? statusCode,
Implementation
CustomException({
required this.type, // Type of Exception
String? exceptionMessage, // Exception's Message/Description
this.exceptionPath, // Exception's file path
required this.deviceInfo, // Device's Info
required this.userInfo, // User's Info
this.response, // Api Response, if Exception is a DioException
this.request, // Api Request, if Exception is a DioException
this.statusCode, // Api Response code, if Exception is a DioException
}) : message = (exceptionMessage != null && exceptionMessage.isNotEmpty)
? exceptionMessage
: type == ExceptionType.unAuthorized
? 'Unauthorized'
: type == ExceptionType.notFound
? 'Resource Not Found'
: type == ExceptionType.connectionTimeout
? 'Connection Timeout'
: type == ExceptionType.internalServerError
? 'Internal Server Error'
: type == ExceptionType.receiveTimeout
? 'Receive Timeout'
: type == ExceptionType.sendTimeout
? 'Send Timeout'
: type == ExceptionType.unKnownDioException
? 'Unknown Dio Exception'
: type == ExceptionType.unKnownException
? 'Unknown Exception'
: 'Unknown Exception';