Repository navigation
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1165 +/- ##
=======================================
Coverage 93.76% 93.76%
=======================================
Files 28 28
Lines 6267 6267
Branches 656 611 -45
=======================================
Hits 5876 5876
Misses 391 391
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
I'm a little worried about this one, because when I write error handling for libraries I tend to assume integer error codes, for instance I would expect RequestError.code to be 500 not "500".
I think the appropriate fix would perhaps be switching the type to allow string | number, we should then make sure that a number error code is not mistakenly turned into a string anywhere in the flow of the application.
A string error code like ENOTFOUND, should remain a string.
A numeric error code like 500, should remain a number.
From the time of initially being thrown during a request with gaxios, through to it being caught by a user.
|
@bcoe, just to clarify, you're not recommending changing any of the existing code, just adding number as a possible type here, right? The problem is that there is functionality currently that attempts to turn the error into a string, but it gets overwritten by the places identified in this PR. I'm worried that if we change that functionality, we'll break other things that depend on the error code being a string when not being passed through |
|
After further discussion, we are going to close this for now but we will open an issue to change the type to accept either a string or number on the next major bump. |
Fixes #1092
GaxiosErrorreturns code as a string, but this method in the auth library overwrites thecodeas a number. We're just updating it to return a string to be consistent.