-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
roachpb: clarify parameter to (*Error).SetDetail
The circuitous error handling has long been a source of confusion, but there are some straightforward modifications, one of which this commit makes: there is no reason to pass an `error` to `SetDetail`; it can always be an `ErrorDetail`. In particular, this prevents a situation which caused problems in the past, namely that of passing an `*Error` to `SetDetail` (which in itself is a method on `*Error`). This is just not possible now, period, because we're also changing `internalError` to *not* implement `ErrorDetailInterface`. Most of the time in this change was verifying that nothing in the code relies on `GetDetail()` always returning a non-nil value for a non-nil `pErr`. I did a full review (prod and tests) and found a few such instances, but the vast majority of callers are of the pattern ```go if pErr != nil { if _, ok := pErr.GetDetail().(*roachpb.SomeErrorDetail); ok { return specialHandling() } return pErr } ``` and thus required no change. Release note: None
- Loading branch information
Showing
8 changed files
with
100 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters