-
Notifications
You must be signed in to change notification settings - Fork 192
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
ORM: replace InputValidationError
with ValueError
or TypeError
#3812
Comments
So, I only currently put a couple of functions in the code, but if I am not misremembering I interpreted that |
My interpretation is that The more general |
|
Are there any other input error types to consider? Else maybe I would change the the title and/or the text to include "replace |
No typically when validating method arguments, it will be either of incorrect type or value, so that is usually all one needs |
InputValidationError
with ValueError
InputValidationError
with ValueError
or TypeError
Coming back to this, I would like to address this for the upcoming A search across the EDIT: did some similar searching in most well-known plugins and found just one occurrence so far in But not even sure that that could actually be thrown by that code. In any case, that entire function could be replaced by |
This was accepted during the meeting of Thursday April 29 2021 |
Reading through the issue and the PR #4888 now, I am wondering: what prevents this issue from recurring? If it really matters to limit its use to the input of processes, I would suggest to include this in the name (e.g. However, since addressing this issue involves backward-incompatible changes, I would also like to understand the use case that gave rise to this issue - @sphuber were you catching |
Reviews on pull requests. There is no need to be using this special exception when a simple
These exceptions weren't necessarily designed to be used outside of
There was no immediate bug that led to this, other than the use of these exceptions are not necessary and even if we wanted to use a specific exception, according to the docstring this was clearly an incorrect one. Its usage has slipped into the ORM a long time ago when people weren't aware and maybe there were no pull requests yet. I am talking way before v1.0 even. By having these exceptions in the ORM, now we are forcing users to a) know that these specific ones can be thrown and b) have to import this exception from |
The
InputValidationError
was intended for use inCalcJob.prepare_for_submission
but is abused in the ORM code to throw when arguments have an invalid value. This should just be communicated through aValueError
.This will be backwards incompatible and so needs to go in
v2.0.0
The text was updated successfully, but these errors were encountered: