Skip to content

Commit

Permalink
bump dependencies for maintanance release
Browse files Browse the repository at this point in the history
  • Loading branch information
willyfromtheblock committed Dec 30, 2023
1 parent 1897242 commit e331f34
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 106 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.1.6
- Update dart, linter & dependencies
- Dio 5.4.0 is now used

# 2.1.5
- Correctly forward RPC errors that are not 404
- disable loggint to print
Expand Down
18 changes: 11 additions & 7 deletions lib/src/rpcclient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@ class RPCClient {
}
return body['result'];
}
} on DioError catch (e) {
if (e.type == DioErrorType.response) {
} on DioException catch (e) {
if (e.type == DioExceptionType.badResponse) {
var errorResponseBody = e.response!.data;

switch (e.error) {
case "Http status error [401]":
switch (e.response!.statusCode) {
case 401:
throw HTTPException(
code: 401,
message: 'Unauthorized',
);

case "Http status error [404]":
case 404:
if (errorResponseBody['error'] != null) {
var error = errorResponseBody['error'];
throw RPCException(
Expand Down Expand Up @@ -162,12 +162,16 @@ class RPCClient {
message: 'Internal Server Error',
);
}
} else if (e.type == DioErrorType.other) {
} else if (e.type == DioExceptionType.connectionError) {
throw HTTPException(
code: 500,
message: e.message,
message: e.message ?? 'Connection Error',
);
}
throw HTTPException(
code: 500,
message: e.message ?? 'Unknown Error',
);
}
}
}

0 comments on commit e331f34

Please sign in to comment.