resolveLongExceptionMessage function
String
resolveLongExceptionMessage(
- dynamic exception
)
Implementation
String resolveLongExceptionMessage(dynamic exception) {
if (exception is SapHeadersException) {
return exception.additionalInfo ?? exception.message;
}
if (exception is ApiResponseException) {
return exception.maybeMap(
general: (e) => e.body,
csrfToken: (e) => e.body,
orElse: () => exception.message,
);
}
if (exception is AppException) {
return exception.message;
}
if (exception is PlatformException) {
return exception.message ??
BasfLogicLocalizationUtils.localizations.somethingWentWrong;
}
if (exception is TimeoutException) {
return exception.message;
}
if (exception is ArgumentError) {
return '${exception.runtimeType}: ${exception.message}';
}
if (exception is DioException &&
(exception.message?.contains(_xmlHttpRequestErrorText) ?? false)) {
return XMLHttpRequestException().message;
}
if (exception is DioException) {
return _formatDioLongError(exception);
}
return '$exception';
}