Timeline for Is it bad to use checked exceptions as API response?
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 19, 2021 at 12:29 | comment | added | Vincent Savard | Your implementation violates the Tell, Don't Ask principle [1,2]. I believe you also have a misconception about what a responsibility is. There's nothing fundamentally wrong with OP's code (and your implementation may be acceptable in some contexts as well, even if it violates the principle). | |
| Aug 19, 2021 at 11:15 | comment | added | George Z. | I see. So, the "alternative" is to let the client with more code - do all the checking. And then I guess, the exceptions can remain as unchecked. | |
| Aug 19, 2021 at 7:27 | comment | added | Jeremy Hunt |
(It may also be reasonable for user.changePassword(newPassword) to throw an Exception to say that it won't set a weak password at that level, so that one could maybe stay...)
|
|
| Aug 19, 2021 at 7:21 | history | answered | Jeremy Hunt | CC BY-SA 4.0 |