Skip to content

Conversation

@justinattw
Copy link

@justinattw justinattw commented Jan 6, 2026

NOTE: This PR is based on #737
For now, I've opened a PR in justinattw#1 that reviews the change into the dependent PR.

Changes
Based on (and requires first merging of) #737
Closes #736

https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode specifies that google.rpc.QuotaFailure is returned with FCM.

We expose this via the new public API GetQuotaFailure(err *errorutils.FirebaseError) *QuotaFailure method.

I also refactored the messaging.go error-related code bits into messaging_errors.go.

justinattw and others added 5 commits January 6, 2026 12:02
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@gemini-code-assist
Copy link

Summary of Changes

Hello @justinattw, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the error handling capabilities of the Firebase Admin Go SDK, particularly for Firebase Cloud Messaging. It introduces a new public API to programmatically access detailed quota failure information, which is crucial for applications dealing with rate limits. Concurrently, it undertakes a substantial refactoring effort by moving common error types and utilities to a dedicated errorutils package, ensuring a more standardized and accessible error reporting mechanism throughout the SDK.

Highlights

  • Public API for Quota Failures: Introduced a new public API function, GetQuotaFailure(err *errorutils.FirebaseError) *QuotaFailure, in the messaging package. This function allows developers to extract detailed quota violation information from Firebase Cloud Messaging (FCM) errors, providing insights into which specific quotas were exceeded.
  • Error Handling Refactoring: The core FirebaseError type and ErrorCode constants have been moved from the internal package to a new, publicly accessible errorutils package. This change promotes consistency and reusability of error types across the SDK.
  • Messaging Error Code Consolidation: FCM-specific error handling logic and related helper functions (e.g., IsInternal, IsQuotaExceeded) have been extracted from messaging.go into a new file, messaging_errors.go, improving modularity and maintainability.
  • FirebaseError Field Renaming: The String field within the FirebaseError struct has been consistently renamed to Message across various service implementations (Auth, DB, IID, Remote Config) to better reflect its purpose.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

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 introduces a significant and beneficial refactoring of the error handling mechanism by exposing error-related types and functions in a new public errorutils package. This makes the error handling more transparent and idiomatic for users of the SDK. The core change of replacing the internal String field with a public Message field in FirebaseError is consistently applied across the codebase.

Additionally, this PR adds a new public API, GetQuotaFailure, to the messaging package, which allows developers to inspect detailed quota failure information from FCM. The related error handling logic has been cleanly refactored into a new messaging_errors.go file.

The changes are well-implemented and include comprehensive tests. I have a couple of suggestions to further improve the ergonomics and maintainability of the new additions.

justinattw and others added 2 commits January 6, 2026 16:21
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

1 participant