googleapis / googleapis/google-cloud-dart

Improve HttpResponseException

Open
#317 0 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: feature request
Dominant language
Dart
Stars
23
Forks
15
Avg merge
1d 9h
Merged PRs (30d)
21

Description

**Is your feature request related to a problem? Please describe.**
Recently the `firebase_functions` package transitioned from its own `HttpsError` to this packages `HttpResponseException`. Clients lost the ability to provide arbitrary details since `HttpResponseException` forces `List>?` for details.

From my limited understanding, the reason for this forced type signature is to be able to log requests, however, in general the client could receive virtually any json value?

**Describe the solution you'd like**
It would be great if `HttpResponseException` supported arbitrary "details" to send to the client. The best way I can think of is to provide two fields, one for details sent to logging and another to send to the client. This would also enable developers to selectively disclose more details.

**Describe alternatives you've considered**
- Wrapping code in my own error handlers. But for instance `firebase_functions` implements callable requests in a way you can only report errors through exceptions. Meaning I'd have to avoid using existing APIs and choose a lower-level solution, to achieve this.
- Creating a special list that overrides `toJson()` and returns the actual value I want. (This can be achieved by abusing how JsonEncoder works.

Contributor guide

Open the contributing guide

Research direction

Start by locating HttpResponseException in the google-cloud-dart package and reviewing how firebase_functions uses it for callable requests and request logging. Define how arbitrary JSON details are separated between client responses and logs, then verify that existing error handling remains compatible and that clients receive the intended values.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.