Skip to content

refactor: replace manual Response(4xx/5xx) with HttpResponseException - #220

Merged
kevmoo merged 2 commits into
mainfrom
i210_child_next
Jul 7, 2026
Merged

refactor: replace manual Response(4xx/5xx) with HttpResponseException#220
kevmoo merged 2 commits into
mainfrom
i210_child_next

Conversation

@kevmoo

@kevmoo kevmoo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Manual Response(4xx) and Response(5xx) returns across event namespaces are replaced with throwing HttpResponseException from package:google_cloud_shelf. This ensures that createLoggingMiddleware records warning and error logs with full stack traces, inner errors, and trace correlation in Cloud Logging.

Summary of Changes:

  • Replace manual Response(400) and Response(500) returns across 13 namespace files (alerts, app_distribution, billing, crashlytics, performance, database, eventarc, firestore, pubsub, remote_config, storage, tasks, test_lab) with throwing HttpResponseException.
  • Replace manual 501 responses in firestore_namespace.dart with throwing HttpResponseException.notImplemented.
  • Update 400 error unit tests in storage_test.dart and remote_config_test.dart to use findHandler for testing via the full middleware pipeline.

Fixes #215

Manual `Response(4xx)` and `Response(5xx)` returns across event namespaces are replaced with throwing `HttpResponseException` from `package:google_cloud_shelf`. This ensures that `createLoggingMiddleware` records warning and error logs with full stack traces, inner errors, and trace correlation in Cloud Logging.

Summary of Changes:
- Replace manual `Response(400)` and `Response(500)` returns across 13 namespace files (`alerts`, `app_distribution`, `billing`, `crashlytics`, `performance`, `database`, `eventarc`, `firestore`, `pubsub`, `remote_config`, `storage`, `tasks`, `test_lab`) with throwing `HttpResponseException`.
- Replace manual 501 responses in `firestore_namespace.dart` with throwing `HttpResponseException.notImplemented`.
- Update 400 error unit tests in `storage_test.dart` and `remote_config_test.dart` to use `findHandler` for testing via the full middleware pipeline.

Fixes #215

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request refactors error handling across multiple namespace files by replacing direct Response returns with throwing HttpResponseException (such as badRequest, notImplemented, and internalServerError) from the google_cloud_shelf package. It also updates catch blocks to capture and propagate stack traces and inner errors, and updates unit tests to use findHandler instead of _findFunction. There are no review comments to address, and I have no additional feedback to provide.

@kevmoo
kevmoo requested a review from brianquinlan July 7, 2026 00:29
@kevmoo
kevmoo merged commit 7b3fbef into main Jul 7, 2026
19 checks passed
@kevmoo
kevmoo deleted the i210_child_next branch July 7, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

replace manual Response(4xx/5xx) returns with HttpResponseException across namespaces

2 participants