chore: simplify parsing numbers with overflow (#3610)

This commit is contained in:
Kevin Wan
2023-10-09 21:00:09 +08:00
committed by GitHub
parent ff230c4b1d
commit 5aedd9c076
2 changed files with 26 additions and 81 deletions

View File

@@ -622,7 +622,7 @@ func (u *Unmarshaler) processFieldPrimitiveWithJSONNumber(fieldType reflect.Type
}
if fValue > math.MaxFloat32 {
return float32OverflowError(v.String())
return fmt.Errorf("parsing %q as float32: value out of range", v.String())
}
target.SetFloat(fValue)