Skip to content

Commit

Permalink
TF-1963 Add catch error message in remote exception thrower
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 authored and hoangdat committed Jun 28, 2023
1 parent 335536f commit e4ab29b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/main/exceptions/remote_exception_thrower.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ class RemoteExceptionThrower extends ExceptionThrower {
} else if (error.error is SocketException) {
throw const SocketError();
} else {
throw UnknownError(
code: error.response?.statusCode,
message: error.response?.statusMessage);
if (error.response != null) {
throw UnknownError(
code: error.response!.statusCode,
message: error.response!.statusMessage);
} else if (error.error != null) {
throw UnknownError(message: error.error!.toString());
} else {
throw const UnknownError();
}
}
}
} else if (error is ErrorMethodResponseException) {
Expand Down

0 comments on commit e4ab29b

Please sign in to comment.