BaseApiException.createFromDioException constructor
BaseApiException.createFromDioException(
- DioException dioException
Implementation
factory BaseApiException.createFromDioException(DioException dioException) {
switch (dioException.type) {
case DioExceptionType.connectionTimeout:
return const BaseApiException.connectionTimeout();
case DioExceptionType.sendTimeout:
return const BaseApiException.sendTimeout();
case DioExceptionType.receiveTimeout:
return const BaseApiException.receiveTimeout();
case DioExceptionType.badCertificate:
return const BaseApiException.badCertificate();
case DioExceptionType.badResponse:
return BaseApiException.badResponse(
response: dioException.response,
statusCode: dioException.response?.statusCode);
case DioExceptionType.cancel:
return BaseApiException.cancel(
error: dioException.error, options: dioException.requestOptions);
case DioExceptionType.connectionError:
return const BaseApiException.connectionError();
case DioExceptionType.unknown:
return BaseApiException.businessException(
message: 'unknown : ${dioException.error}',
error: dioException.error,
stackTrace: dioException.stackTrace);
}
}