Skip to content

Commit

Permalink
Implement Unwrap for type RedisError
Browse files Browse the repository at this point in the history
  • Loading branch information
hjr265 committed Apr 14, 2024
1 parent 6b38f77 commit 7ae3670
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@ type RedisError struct {
Err error
}

func (err RedisError) Error() string {
return fmt.Sprintf("node #%d: %s", err.Node, err.Err)
func (e RedisError) Error() string {
return fmt.Sprintf("node #%d: %s", e.Node, e.Err)
}

func (err RedisError) Is(target error) bool {
return errors.Is(err.Err, target)
}

func (err RedisError) As(target any) bool {
return errors.As(err.Err, target)
func (e RedisError) Unwrap() error {
return e.Err
}

0 comments on commit 7ae3670

Please sign in to comment.