From 50c3bce98d230a7a682b4f1f9bb7f7307ae2adbb Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Wed, 12 Jan 2022 21:34:38 +0100 Subject: [PATCH] Change if/if to if/else-if when checking the type of JSON error --- authority/tls.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/authority/tls.go b/authority/tls.go index 78f629e7..cc049655 100644 --- a/authority/tls.go +++ b/authority/tls.go @@ -573,8 +573,7 @@ func templatingError(err error) error { if errors.As(err, &syntaxError) { // offset is arguably not super clear to the user, but it's the best we can do here cause = fmt.Errorf("%s at offset %d", cause.Error(), syntaxError.Offset) - } - if errors.As(err, &typeError) { + } else if errors.As(err, &typeError) { // slightly rewriting the default error message to include the offset cause = fmt.Errorf("cannot unmarshal %s at offset %d into Go value of type %s", typeError.Value, typeError.Offset, typeError.Type) }