Skip to content

Commit 880ef4e

Browse files
committed
Fix: improve error message for invalid field types in ASCII validation
1 parent d37f85f commit 880ef4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

baked_in.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ func isPrintableASCII(fl FieldLevel) bool {
538538
if field.Kind() == reflect.String {
539539
return printableASCIIRegex().MatchString(field.String())
540540
}
541-
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
541+
panic(fmt.Sprintf("Bad field type %s", field.Type()))
542542
}
543543

544544
// isASCII is the validation function for validating if the field's value is a valid ASCII character.
@@ -547,7 +547,7 @@ func isASCII(fl FieldLevel) bool {
547547
if field.Kind() == reflect.String {
548548
return aSCIIRegex().MatchString(field.String())
549549
}
550-
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
550+
panic(fmt.Sprintf("Bad field type %s", field.Type()))
551551
}
552552

553553
// isUUID5 is the validation function for validating if the field's value is a valid v5 UUID.

0 commit comments

Comments
 (0)