util.decorateRequest should confirm error is a missing project ID error #2069
Labels
core
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
A bug in the
google-cloud
package resulted in the following error:The reason I am getting this error is this code block:
Here
catch
assumes that any error that occurred intry
is equivalent tomissingProjectIdError
.Instead of blindly assuming what is the error, use
instanceof
check and a custom error constructor, e.g. https://github.com/gajus/xfetch/blob/0d8cd012354b0bb8b67162f74b2a9e126d3bdabb/src/attemptRequest.js#L52-L67.Furthermore, what made it hard to debug is the lack stack trace (raised a separate issue #2068).
The text was updated successfully, but these errors were encountered: