Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkgs/cupertino_http/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## 2.4.0-wip

* Switch to `package:objective_c` `8.1.0` and `package:ffigen` `19.1.0`.

* Add URL to thrown `RequestAbortedException`.

## 2.3.0

* Add the ability to abort requests.
Expand Down
6 changes: 5 additions & 1 deletion pkgs/cupertino_http/lib/src/cupertino_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,18 @@ class CupertinoClient extends BaseClient {
// 2. The user aborts the request, which can happen at any point in the
// request lifecycle and causes `CupertinoClient.send` to throw
// a `RequestAbortedException` exception.
//
// In both of these cases [URLSessionTask.cancel] is called, which completes
// the task with a NSURLErrorCancelled error.
final isCancelError =
error?.domain.toDartString() == 'NSURLErrorDomain' &&
error?.code == _nsurlErrorCancelled;
if (error != null &&
!(isCancelError && taskTracker.responseListenerCancelled)) {
final Exception exception;
if (isCancelError) {
exception = RequestAbortedException();
assert(taskTracker.requestAborted);
exception = RequestAbortedException(taskTracker.request.url);
} else {
exception = NSErrorClientException(error, taskTracker.request.url);
}
Expand Down
Loading