dart-lang / dart-lang/http

HttpException stacktrace is lost when ClientException is thrown

Open
#498 9 comments 8 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
1.1k
Forks
419
Avg merge
4d 14h
Merged PRs (30d)
8

Description

When a `ClientException` is thrown [from here in `io_client.dart`](https://github.com/dart-lang/http/blob/7774121a406fedb0502fce7cc224476c1ac78469/lib/src/io_client.dart#L65), it does not preserve the original HttpException's stacktrace (because of [this still open issue](https://github.com/dart-lang/sdk/issues/30741) there is no way to preserve the original stacktrace if not rethrowing the original exception).

This makes it almost impossible to debug issues such as [this one](https://github.com/dart-lang/sdk/issues/37695) when the exceptions are being reported via crash analytics and are not easily reproducible under a debugger.

Contributor guide

Open the contributing guide

Research direction

The throw path is lib/src/io_client.dart around line 65; start by reading how ClientException is created and review Dart SDK issue 30741. Done means the original HttpException stack trace is available through ClientException for crash reporting, with the affected behavior covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.