Skip to content

feat(cronet_http): decode cronet exceptions#1912

Merged
brianquinlan merged 12 commits intodart-lang:masterfrom
brianquinlan:cronet_ex
May 4, 2026
Merged

feat(cronet_http): decode cronet exceptions#1912
brianquinlan merged 12 commits intodart-lang:masterfrom
brianquinlan:cronet_ex

Conversation

@brianquinlan
Copy link
Copy Markdown
Collaborator

@brianquinlan brianquinlan commented Apr 27, 2026

Fixes #1883

Decodes the Java CronetException into equivalent Dart classes (which are `ClientException subclasses).

Also snuck in the removal of an unnecessary server setup in testQuicHints.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

Note: The Dart team is trialing Gemini Code Assist. Don't take its comments as final Dart team feedback. Use the suggestions if they're helpful; otherwise, wait for a human reviewer.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

PR Health

License Headers ✔️
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/cupertino_http/example/example.dart
pkgs/http/example/main.dart
pkgs/http_multi_server/test/cert.dart

This check can be disabled by tagging the PR with skip-license-check.

Unused Dependencies ⚠️
Package Status
cronet_http
❗ Show Issues
These packages are used outside lib/ but are not dev_dependencies:
* flutter_test
* http_client_conformance_tests
* http_image_provider
* integration_test
* provider
* test
These packages are only used outside lib/ and should be downgraded to dev_dependencies:
* flutter
These packages may be unused, or you may be using assets from these packages:
* dart_flutter_team_lints
* yaml_edit
Failed to update packages.

For details on how to fix these, see dependency_validator.

This check can be disabled by tagging the PR with skip-unused-dependencies-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Coverage ⚠️
File Coverage
pkgs/cronet_http/example/integration_test/client_profile_test.dart 💔 Not covered
pkgs/cronet_http/example/integration_test/client_test.dart 💔 Not covered
pkgs/cronet_http/example/integration_test/cronet_engine_test.dart 💔 Not covered
pkgs/cronet_http/lib/src/cronet_client.dart 💔 Not covered
pkgs/cronet_http/lib/src/jni/jni_bindings.dart 💔 Not covered

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
cronet_http Non-Breaking 1.8.0 1.9.0-wip 1.9.0-wip ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

@brianquinlan brianquinlan requested a review from goderbauer April 28, 2026 17:58
Copy link
Copy Markdown
Contributor

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

/// A [ClientException] generated from a Java [`NetworkException`][1].
///
/// [1]: https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/NetworkException.html
class NetworkClientException extends CronetClientException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I noticed a tiny inconsistency in naming these exceptions. CallbackException above and QuicException below dropped the "Client" in their name, while the NetworkClientException retained it. Was that an intentional choice or should this also just be NetworkException instead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I removed the "Client" from all of the names. After thinking about it, it just feels like unnecessary repetition.

@brianquinlan brianquinlan merged commit c140dc0 into dart-lang:master May 4, 2026
42 checks passed
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request May 5, 2026
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ai (https://github.com/dart-lang/ai/compare/7270c43..9c96bfe):
  9c96bfe  Mon May 4 09:35:46 2026 -0700  Jacob MacDonald  Add test for DTD discovery (dart-lang/ai#465)
  af7e829  Mon May 4 08:36:10 2026 -0700  Jacob MacDonald  Add test for DTD discovery (dart-lang/ai#465)
  f151df9  Fri May 1 07:54:12 2026 -0700  dependabot[bot]  Bump actions/cache from 5.0.4 to 5.0.5 in the github-actions group (dart-lang/ai#464)
  03d251c  Thu Apr 30 12:34:59 2026 -0700  Jacob MacDonald  add obsolete issues skill (dart-lang/ai#462)

dartdoc (https://github.com/dart-lang/dartdoc/compare/2e30b8e..77a52b6):
  77a52b61  Tue May 5 19:38:04 2026 +0200  dependabot[bot]  Bump analyzer from 12.1.0 to 13.0.0 (dart-lang/dartdoc#4242)
  4fa2b5dd  Fri May 1 22:21:16 2026 +0000  dependabot[bot]  Bump the github-actions group with 3 updates (dart-lang/dartdoc#4241)

ecosystem (https://github.com/dart-lang/ecosystem/compare/ed4e053..319ff81):
  319ff81  Fri May 1 21:48:23 2026 +0000  dependabot[bot]  Bump the github-actions group with 3 updates (dart-lang/ecosystem#414)

http (https://github.com/dart-lang/http/compare/2c84f24..c140dc0):
  c140dc0  Mon May 4 13:22:37 2026 -0700  Brian Quinlan  feat(cronet_http): decode cronet exceptions (dart-lang/http#1912)
  057c768  Fri May 1 03:44:57 2026 +0000  dependabot[bot]  chore(deps): bump the github-actions group with 2 updates (dart-lang/http#1914)

shelf (https://github.com/dart-lang/shelf/compare/cc6b57d..74d58bc):
  74d58bc  Tue May 5 01:52:47 2026 -0700  Kevin Moore  [compliance] Update goldens - 7 fewer failures! (dart-lang/shelf#526)
  c6b3f75  Mon May 4 12:27:31 2026 -0700  dependabot[bot]  Bump actions/cache in the github-actions group across 1 directory (dart-lang/shelf#524)
  498d45e  Mon May 4 12:14:02 2026 -0700  Kevin Moore  test: make compliance golden tests "thoughtful" and clean up state (dart-lang/shelf#525)

test (https://github.com/dart-lang/test/compare/d5da922..14f99ec):
  14f99ecd  Fri May 1 16:18:32 2026 -0700  Nate Bosch  Track the OS for browser platforms (dart-lang/test#2449)
  fd2b4be6  Fri May 1 16:08:03 2026 -0700  Nate Bosch  Override test packages in coverage tests (dart-lang/test#2638)
  a1b82f18  Fri May 1 04:03:25 2026 +0000  dependabot[bot]  Bump the github-actions group with 3 updates (dart-lang/test#2637)

tools (https://github.com/dart-lang/tools/compare/c0dc794..6a7dd15):
  6a7dd157  Tue May 5 09:41:25 2026 -0700  Jacob MacDonald  support initial selection for multiselect, as well as select/unselect all (dart-lang/tools#2399)
  1a026068  Fri May 1 06:11:14 2026 +0000  dependabot[bot]  Bump actions/upload-pages-artifact from 4 to 5 in the github-actions group (dart-lang/tools#2392)

web (https://github.com/dart-lang/web/compare/7c908b1..294391c):
  294391c  Mon May 4 09:59:58 2026 -0700  Kevin Moore  [chore] Sort the members in elements.dart (dart-lang/web#544)
  41c4049  Mon May 4 09:35:13 2026 -0700  Kevin Moore  refactor: move most of the AST elements to their own file (dart-lang/web#543)

webdev (https://github.com/dart-lang/webdev/compare/d33d270..f9a5660):
  f9a56607  Fri May 1 14:48:09 2026 -0700  MarkZ  Splitting additional DWDS and Webdev tests between amd and ddc module systems (dart-lang/webdev#2828)
  b2cd91f6  Thu Apr 30 13:02:04 2026 -0700  Nicholas Shahan  [dwds] Prepare to publish 27.1.1 (dart-lang/webdev#2825)

Change-Id: Ifa3631598d554132a3f457a0e5d9e02089e5ce32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/500980
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using specific exception types instead of generic ClientException in case of error

2 participants