Refactor error handling in AuthCubit and ServerFailure

Update error handling in AuthCubit to use toString() method and mdified
handling of badResponse in ServerFailure class.
This commit is contained in:
Mohammad Salameh
2024-03-19 15:13:00 +03:00
parent cb913cd784
commit d4a9cfb7ab
2 changed files with 3 additions and 3 deletions

View File

@ -28,8 +28,8 @@ class ServerFailure extends Failure {
return ServerFailure("Bad certificate!");
case DioExceptionType.badResponse:
return ServerFailure.fromResponse(
dioError.response!.statusCode!, dioError.response!.data);
return ServerFailure.fromResponse(dioError.response!.statusCode!,
dioError.response!.data!["message"]);
case DioExceptionType.cancel:
return ServerFailure("The request to ApiServer was canceled");