firebase-admin-go icon indicating copy to clipboard operation
firebase-admin-go copied to clipboard

errorutils does not work with wrapped errors

Open Azuka opened this issue 2 years ago • 1 comments
trafficstars

[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:

https://github.com/firebase/firebase-admin-go/blob/61c6c041bf807c045f6ff3fd0d02fc480f806c9a/internal/errors.go#L100

Relevant Code:

// err works with errorutils.IsNotFound
_, err := authClient.GetUserByEmail(ctx, "[email protected]")
// 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.

Azuka avatar May 14 '23 07:05 Azuka

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.

google-oss-bot avatar May 14 '23 07:05 google-oss-bot