Open AustinHunt opened 10 months ago
I'm using Firebase Auth, when it fails to verify a token, Im able to know the reason from the message, however, because the ErrorCode and Ext fields are not exposed, I'm not able to handle each case programmaticlly.
So yep, it will be really helpful to expose the fields and error codes, please add the feature, thank you!
I also have troubles with the FirebaseError
being in an internal package, since there is no way to use it in e.g. errors.Is
or errors.As
(the idiomatic way to compare errors) as well as to create such an error on my own (e.g. in a mock used in unit tests), which makes it unnecessarily hard to test code using this module for interactions with Firebase. Since the FirebaseError
is returned from the methods provided by this module, I consider it as part of the API and therefore it should be exposed.
The errorutils
package is somewhat helpful, but to me, it looks more like a workaround.
@lahirumaramba I see you are most active maintainer so just wanted to ask if this is something you are considering to expose?
It would be extremely useful like others mentioned already.
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
The messaging api returns robust error codes to tell your application what went wrong with the server. This go-lang library abstracts this away and only gives you the following struct: https://github.com/firebase/firebase-admin-go/blob/v4.12.0/messaging/messaging_batch.go#L78
This makes it impossible to react to different kinds of failures when calling
sendBatch
. In my case, I want to remove invalid device tokens from my database.If the lib could return this struct (https://github.com/firebase/firebase-admin-go/blob/74c9bd5edece6044ba365a04c32c00074006dd7c/internal/errors.go#L87) instead of the standard error the issue would be resolved.
Relevant Code:
The internal library has the data structure I need, but it is in the internal library and unavailable to other modules.