customize errors
i am quite new to this library and knowing that arktype support regexp validation, i am surprised, but now my question is
how do i even explain this regexp to the user?
i know that i can do
but that doesnt explain much to the user that has no regexp experience,
is there a way to return a more reasonable errors?
like for example
the regexp:
"/^\\s*[a-zA-Z0-9_]{3,16}\\s*$/"
when the user put less than 3 characters in the username field then return the username must be atleast 3 character
thanks in advance3 Replies
You can set the
message
instead of the problem
And then just provide a better error message yourselfthank you, but how about specific case like the user put too much characters
i assume i can use .narrow for that?
Just use an if statement :Shrug:
Per your example it's a function, so you can just return different things based on what the user entered