return UnexpectedToken when trying to parse a string as a int

This commit is contained in:
D-Berg 2024-11-10 14:44:39 +01:00
parent 560d6b99d5
commit a7792b4563

View File

@ -239,7 +239,8 @@ pub fn innerParse(
const token = try source.nextAllocMax(allocator, .alloc_if_needed, options.max_value_len.?);
defer freeAllocated(allocator, token);
const slice = switch (token) {
inline .number, .allocated_number, .string, .allocated_string => |slice| slice,
inline .number, .allocated_number => |slice| slice,
.string, .allocated_string => return error.UnexpectedToken,
else => return error.UnexpectedToken,
};
return sliceToInt(T, slice);