Skip to content

Commit

Permalink
chore: improve readability with switch case
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanhitt committed Nov 27, 2024
1 parent dd4b6dd commit 47b4fef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ func (e NotAcceptableError) Unwrap() error { return HTTPError(e) }
// interface the error is returned.
func ErrorHandler(err error) error {
var errorStatus ErrorWithStatus
if errors.As(err, &HTTPError{}) || errors.As(err, &errorStatus) {
switch {
case errors.As(err, &HTTPError{}),
errors.As(err, &errorStatus):
return handleHTTPError(err)
}

Expand Down

0 comments on commit 47b4fef

Please sign in to comment.