-
Couldn't load subscription status.
- Fork 18.4k
Open
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
The url.Error type uses type assertion in the Timeout() and Temporary() method to delegate the work to the wrapped error:
Lines 32 to 44 in 0cd9064
| func (e *Error) Timeout() bool { | |
| t, ok := e.Err.(interface { | |
| Timeout() bool | |
| }) | |
| return ok && t.Timeout() | |
| } | |
| func (e *Error) Temporary() bool { | |
| t, ok := e.Err.(interface { | |
| Temporary() bool | |
| }) | |
| return ok && t.Temporary() | |
| } |
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 to Timeout() or Temporary() to the next error in the chain who implements this interface - and not only to the direct wrapped error as it is done today.
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.