Bläddra i källkod

Change if/if to if/else-if when checking the type of JSON error

Herman Slatman 4 år sedan
förälder
incheckning
50c3bce98d
1 ändrade filer med 1 tillägg och 2 borttagningar
  1. 1 2
      authority/tls.go

+ 1 - 2
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)
 	}