-
Notifications
You must be signed in to change notification settings - Fork 148
Closed
Description
The lib uses dio internally which forces consumers to catch the error if an unsuccessful call throws a DioError.
We currently use this helper method to map unsuccessful calls to own exception/other exception types.
// Some calls fail because Dio is used internally and this will throw instead
// of returning a 4xx response.
Future<R> _catchApiErrors<R>(FutureOr<R> Function() call) async {
try {
return await call();
} on DioError catch (error) {
if (error.response.statusCode == 401) {
throw ApiException.unauthorized(); // own exception type
}
rethrow;
}
}I just want to point out that this is not an issue atm, but it might be a nice thing to improve.
Feel free to close this issue 👍
lohanidamodar, eldadfux and mlucas-NU
Metadata
Metadata
Assignees
Labels
No labels