firebase / firebase-admin-go

Firebase Admin Go SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

errorutils does not work with wrapped errors

Azuka opened this issue · comments

[REQUIRED] Step 2: Describe your environment

  • Operating System version: any
  • Firebase SDK version: v4
  • Library version: current
  • Firebase Product: auth

[REQUIRED] Step 3: Describe the problem

Related to #416, a wrapped firebase internal error cannot be introspected

Steps to reproduce:

fe, ok := err.(*FirebaseError)

Relevant Code:

// err works with errorutils.IsNotFound
_, err := authClient.GetUserByEmail(ctx, "example@example.com")
// errorutils.IsNotFound doesn't work
err = fmt.Errorf("[AuthService] %w")

Solution

Use errors.As instead of a simple typecast. I can open a pull request right away.

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.