Skip to content

Commit 190f840

Browse files
Merge pull request #297 from floaust/master
fix nil pointer in errors.Hide()
2 parents 27d8acc + c01f9d2 commit 190f840

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

maintenance/errors/context.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ import (
1313
// the optional exposedErr is provided, it is attached as prefix
1414
// to the returned error. If the given err is not any of the above
1515
// ones, the given exposedErr (if present) is wrapped as prefix
16-
// to the returned error.
16+
// to the returned error, if there is an err that is not nil.
1717
func Hide(ctx context.Context, err, exposedErr error) error {
18+
if err == nil {
19+
return nil
20+
}
21+
1822
ret := errors.New(err.Error())
1923
if exposedErr != nil {
2024
ret = fmt.Errorf("%w: %s", exposedErr, err)

0 commit comments

Comments
 (0)