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

pull/792/head
Herman Slatman 2 years ago
parent a3cf6bac36
commit 50c3bce98d
No known key found for this signature in database
GPG Key ID: F4D8A44EA0A75A4F

@ -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)
}

Loading…
Cancel
Save