Timeline for Is returning true or throwing an exception good or bad code practice?
Current License: CC BY-SA 4.0
3 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 29, 2021 at 11:41 | comment | added | proeng | I do think your comment where helpful in showing why my first approach is not good design. I was throwing the messages using exception, but i learned now it is expensive and not intuitive. So having a function that return true or false, aswell as the message seems clearer. | |
| Sep 28, 2021 at 20:41 | comment | added | David Arno | The example code in the question very clearly shows that the exception message is captured and returned. Your comments about not returning such information being bad is correct but it is unrelated to this question. | |
| Sep 28, 2021 at 13:26 | history | answered | Phill W. | CC BY-SA 4.0 |