-
Notifications
You must be signed in to change notification settings - Fork 97
do not warn on false-but-blessed exceptions #1020
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
base: master
Are you sure you want to change the base?
Conversation
While some consider this not best practice, blessed objects that overload to a false result are legitimate and should not be prevented.
6471f04 to
0f6cf98
Compare
|
Is this something you ran into in real code? This behavior matches what Test::Fatal does. Quoting its docs:
If this was merged, the message inside the unless condition would probably need to be updated, as it wouldn't be complaining about every falsy exception. |
|
Yes, I am working with an object that has a boolean overload, where false indicates a negative outcome and true indicates a successful one. A method that returns one of these objects can also throw an exception, which naturally I would like to wrap tests around. An exception consisting of |
|
It's a method that can return one of the objects or throw the same type of object? It sounds like a very weird interface.
This probably needs a test. The docs include a section |
|
I agree with @haarg needs some doc updates and a test, then I am willing to merge this. Though I also have to be sure nothing downstream breaks as it is possible other test tools depend on (and test for) this behavior, though that is pretty unlikely. |
No, it's a constructor method that returns a thing, or throws something else (which has a success/fail? boolean overload, as it is returned as the normal result in other places) if there was an error during construction. My opinion would be that Test::Fatal should change as well -- I've always thought it odd that it is opinionated about falsey exceptions -- but given its age the ramifications of that change might be greater. Test2's exception plugin is much newer so it is easier to change to do the "more right" thing. |
|
While some consider this not best practice, blessed objects that overload to a false result are legitimate and should not be prevented.