-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
solver: mark history and graph concistency errors as internal
Error during creating history or failure in graph concistency checks are signs of either bugs or system configuration issue. This makes sure that gRPC error code in the API error based on these cases has correct value to signify it. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
- Loading branch information
1 parent
8f4aa21
commit 5149ea8
Showing
4 changed files
with
44 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package errdefs | ||
|
||
import "errors" | ||
|
||
type internalErr struct { | ||
error | ||
} | ||
|
||
func (internalErr) System() {} | ||
|
||
func (err internalErr) Unwrap() error { | ||
return err.error | ||
} | ||
|
||
type system interface { | ||
System() | ||
} | ||
|
||
var _ system = internalErr{} | ||
|
||
func Internal(err error) error { | ||
if err == nil { | ||
return nil | ||
} | ||
return internalErr{err} | ||
} | ||
|
||
func IsInternal(err error) bool { | ||
var s system | ||
return errors.As(err, &s) | ||
} |
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