Skip to content

Commit 10c69ef

Browse files
Short circuit return errors from JSONWebKey.UnmarshalJSON() (#141)
Noted a few `fmt.Errorf()` errors that can be exited early.
1 parent 15bc4c2 commit 10c69ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jwk.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,10 @@ func (k *JSONWebKey) UnmarshalJSON(data []byte) (err error) {
239239
keyPub = key
240240
}
241241
} else {
242-
err = fmt.Errorf("go-jose/go-jose: unknown curve %s'", raw.Crv)
242+
return fmt.Errorf("go-jose/go-jose: unknown curve %s'", raw.Crv)
243243
}
244244
default:
245-
err = fmt.Errorf("go-jose/go-jose: unknown json web key type '%s'", raw.Kty)
245+
return fmt.Errorf("go-jose/go-jose: unknown json web key type '%s'", raw.Kty)
246246
}
247247

248248
if err != nil {

0 commit comments

Comments
 (0)