CustomException constructor

CustomException({
  1. required ExceptionType type,
  2. String? exceptionMessage,
  3. String? exceptionPath,
  4. required DeviceInfo deviceInfo,
  5. required Map<String, dynamic> userInfo,
  6. dynamic response,
  7. dynamic request,
  8. 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';