Skip to content

Commit

Permalink
Replace deprecated API syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
7h30n3 committed Oct 13, 2023
1 parent c64b2f6 commit 83fac3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/src/commons/osm_exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ class OSMUnknownException extends OSMAPIException {
/**
* Map dio response errors to custom OSM API exceptions
*/
Future<Response<dynamic>> handleDioErrors(DioError error, StackTrace stackTrace) {
Future<Response<dynamic>> handleDioException(DioException error, StackTrace stackTrace) {

final response = error.response;
final message = response?.data ?? response?.statusMessage ?? error.message;

if (error.type == DioErrorType.badResponse && error.response?.statusCode != null) {
if (error.type == DioExceptionType.badResponse && error.response?.statusCode != null) {
switch (response!.statusCode) {
case 400: return Future.error(OSMBadRequestException(message));
case 401: return Future.error(OSMUnauthorizedException(message));
Expand All @@ -224,7 +224,7 @@ Future<Response<dynamic>> handleDioErrors(DioError error, StackTrace stackTrace)
default: return Future.error(OSMUnknownException(response.statusCode!, message));
}
}
else if (error.type == DioErrorType.connectionError && error.error is SocketException) {
else if (error.type == DioExceptionType.connectionError && error.error is SocketException) {
return Future.error(OSMConnectionException(message));
}
return Future.error(error);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/osm_apis/osm_api_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ abstract class OSMAPIBase {
path,
data: body,
options: options
).onError<DioError>(handleDioErrors);
).onError<DioException>(handleDioException);
}


Expand Down

0 comments on commit 83fac3f

Please sign in to comment.