Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-07-26 13:38:01 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-07-28 13:35:56 +0300
commit2b0dedfc85c469d4e4a7f767ae0c09da346cb4b7 (patch)
tree212f309d735ea7b93591cb8ddb15429535b724a1
parent492fc72a7d8f6e159b4497d206eb94c3aa788b89 (diff)
helper: Remove needless condition in `DecorateError()`
The `DecorateError()` helper function explicitly checks whether the passed error is `nil`. Given that `GrpcCode()` always returns OK in case it's passed a `nil` error though, and that `DecorateError()` requires the code to be Unknown in order to wrap it, this condition is needless. Simplify the code by dropping the needless condition.
-rw-r--r--internal/helper/error.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/helper/error.go b/internal/helper/error.go
index 53d6fe208..91879a308 100644
--- a/internal/helper/error.go
+++ b/internal/helper/error.go
@@ -23,7 +23,7 @@ func (sw statusWrapper) Unwrap() error {
// DecorateError unless it's already a grpc error.
// If given nil it will return nil.
func DecorateError(code codes.Code, err error) error {
- if err != nil && GrpcCode(err) == codes.Unknown {
+ if GrpcCode(err) == codes.Unknown {
return statusWrapper{err, status.New(code, err.Error())}
}
return err