I am writing a user input library to easily manage the dynamic creation of forms to query users for data.
I wanted the end developer to "think" about the minimum minimum, so I went to exclude them instead of returning "true" or "false" and remember that we need to process the return value, etc.
In fact, everything turned out very well. Throwing exceptions also gave me the advantage that you can automatically log user errors in the log, all for “free” ones, since throwing an exception causes the logging to be performed.
Having said all this, I was wondering if this is really “against best practices”? Should I save exceptions only in those moments when I did not even expect a user input error, or is it okay to say: "the user has a problem ... what is the exception"?
Any thoughts?
source
share