firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.15k stars 249 forks source link

Are error strings in any way localized? #402

Closed skuskusku closed 4 years ago

skuskusku commented 4 years ago

Step 2: Describe your environment

Step 3: Describe the problem

I am using firebase v4 to push notifications to android devices. When the Send method of the instance of messaging.Client fails, I only get a string error value and I wonder if this error string is localized. If not, I could compare it against e.g. "Requested entity was not found." to detect devices that have uninstalled my app. Is this string always plain english or does this depend on the locale the app is running under? Or does this error string come from the server, so I can never be sure if it stays the same?

What other options do I have to properly detect such an error, even if my golang binary runs on computer systems with any locale or language? I am running my golang binary on windows.

Steps to reproduce:

Send a message that will fail, because the device has uninstalled the app

Relevant Code:

I am using this code to send messages to devices:

response, err := client.Send(ctx, message)
if err != nil {
    logger.Info(err)
    os.Exit(-536870138) /// -536870138 = 0xE0000306 is ERR_INOTE_FCM_FAILED_SEND
}

Any help or insights appreciated,

-- Stefan

google-oss-bot commented 4 years ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

hiranya911 commented 4 years ago

Duplicate of #401