endpoints icon indicating copy to clipboard operation
endpoints copied to clipboard

have @param take an error message

Open Jaymon opened this issue 5 years ago • 1 comments

so if you pass in @param("<NAME>", errmsg=...) it would use that errmsg as the error string if param fails in some way, this would allow us to fine tune client facing error messages

Jaymon avatar Sep 02 '20 01:09 Jaymon

This could be done in call.Param's handle method. Basically do a try/except and then check if there is an errmsg flag, if there is then raise a new ValueError with the error message.

You could also allow minor templating with {value} or something like that and then it will always call format on the error message with certain predefined values (assuming format doesn't fail if it has keywords that aren't in the string)

Jaymon avatar Feb 17 '24 00:02 Jaymon