Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have @param take an error message #109

Open
Jaymon opened this issue Sep 2, 2020 · 1 comment
Open

have @param take an error message #109

Jaymon opened this issue Sep 2, 2020 · 1 comment

Comments

@Jaymon
Copy link
Owner

Jaymon commented Sep 2, 2020

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
Copy link
Owner Author

Jaymon commented Feb 17, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant