Skip to content

Commit

Permalink
Short circuit return errors from JSONWebKey.UnmarshalJSON() (#141)
Browse files Browse the repository at this point in the history
Noted a few `fmt.Errorf()` errors that can be exited early.
  • Loading branch information
magnetikonline authored Jul 30, 2024
1 parent 15bc4c2 commit 10c69ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ func (k *JSONWebKey) UnmarshalJSON(data []byte) (err error) {
keyPub = key
}
} else {
err = fmt.Errorf("go-jose/go-jose: unknown curve %s'", raw.Crv)
return fmt.Errorf("go-jose/go-jose: unknown curve %s'", raw.Crv)
}
default:
err = fmt.Errorf("go-jose/go-jose: unknown json web key type '%s'", raw.Kty)
return fmt.Errorf("go-jose/go-jose: unknown json web key type '%s'", raw.Kty)
}

if err != nil {
Expand Down

0 comments on commit 10c69ef

Please sign in to comment.