Skip to content

Commit

Permalink
Don't panic when pem cannot be decoded
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Chlebek <[email protected]>
  • Loading branch information
echlebek committed Feb 8, 2023
1 parent 2aac054 commit 2140595
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func deregisterEntity(event *corev2.Event) error {

block, _ := pem.Decode([]byte(pemCert))
if block == nil {
panic("failed to parse certificate PEM")
return errors.New("failed to decode sensu-ca-cert PEM")
}

cert, err := x509.ParseCertificate(block.Bytes)
Expand Down

0 comments on commit 2140595

Please sign in to comment.