Skip to content

Commit 00998c7

Browse files
jsonpb: fix a confusing error message (#1125)
The in argument is a []byte. Using the %v print flag prints this list of integers instead of as a string representation of the enum value. Use %q instead.
1 parent 6c66de7 commit 00998c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jsonpb/decode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ func (u *Unmarshaler) unmarshalSingularValue(v protoreflect.Value, in []byte, fd
474474
if hasPrefixAndSuffix('"', in, '"') {
475475
vd := fd.Enum().Values().ByName(protoreflect.Name(trimQuote(in)))
476476
if vd == nil {
477-
return v, fmt.Errorf("unknown value %v for enum %s", in, fd.Enum().FullName())
477+
return v, fmt.Errorf("unknown value %q for enum %s", in, fd.Enum().FullName())
478478
}
479479
return protoreflect.ValueOfEnum(vd.Number()), nil
480480
}

0 commit comments

Comments
 (0)