diff --git a/lib/features/auth/bloc/auth_cubit.dart b/lib/features/auth/bloc/auth_cubit.dart index 408c80d..cf98d3d 100644 --- a/lib/features/auth/bloc/auth_cubit.dart +++ b/lib/features/auth/bloc/auth_cubit.dart @@ -66,7 +66,7 @@ class AuthCubit extends Cubit { emit(AuthError('Something went wrong')); } } on DioException catch (e) { - emit(AuthError(ServerFailure.fromDioError(e).errMessage)); + emit(AuthError(ServerFailure.fromDioError(e).toString())); } } diff --git a/lib/services/api/network_exception.dart b/lib/services/api/network_exception.dart index 2082e97..0cec78b 100644 --- a/lib/services/api/network_exception.dart +++ b/lib/services/api/network_exception.dart @@ -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");