net/url: (*Error).Timeout
and (*Error).Temporary
methods should use errors.As
instead of type assertion
#60578
Labels
FeatureRequest
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
The url.Error type uses type assertion in the Timeout() and Temporary() method to delegate the work to the wrapped error:
go/src/net/url/url.go
Lines 32 to 44 in 0cd9064
In todays time, we shouldn't have implemented the methods like this, but should have left the task of unwrapping the error until some error in the chain implements the wanted interface to the user of the error. But as these methods now are implemented, they should use
errors.As
to delegate the answer toTimeout()
orTemporary()
to the next error in the chain who implements this interface - and not only to the direct wrapped error as it is done today.The text was updated successfully, but these errors were encountered: