From 1d700386d2e0b8a3edded07b6d72e4255aea4b20 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Mon, 13 Oct 2025 13:19:58 -0700 Subject: [PATCH 1/2] docs(cupertino_http): Clarify that happens when a request is cancelled --- pkgs/cupertino_http/lib/src/cupertino_client.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/cupertino_http/lib/src/cupertino_client.dart b/pkgs/cupertino_http/lib/src/cupertino_client.dart index 39adcae25c..5a4110ac81 100644 --- a/pkgs/cupertino_http/lib/src/cupertino_client.dart +++ b/pkgs/cupertino_http/lib/src/cupertino_client.dart @@ -207,6 +207,9 @@ 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; @@ -214,7 +217,8 @@ class CupertinoClient extends BaseClient { !(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); } From d92c45d51cdc4d7076c26022a1e75a804dabad8e Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Mon, 13 Oct 2025 13:29:09 -0700 Subject: [PATCH 2/2] Update CHANGELOG.md --- pkgs/cupertino_http/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/cupertino_http/CHANGELOG.md b/pkgs/cupertino_http/CHANGELOG.md index b93aac4c2a..c0ece78d55 100644 --- a/pkgs/cupertino_http/CHANGELOG.md +++ b/pkgs/cupertino_http/CHANGELOG.md @@ -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.