Timeline for Using exceptions as regular objects [duplicate]
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 26, 2015 at 16:22 | history | closed |
Robert Harvey user53019 Ampt Dan Pichelman user22815 |
Duplicate of Are exceptions as control flow considered a serious antipattern? If so, Why? | |
Mar 25, 2015 at 21:02 | vote | accept | php_nub_qq | ||
Mar 25, 2015 at 20:56 | comment | added | php_nub_qq | @BartvanIngenSchenau that is the point of the whole question. The view I'm rendering was meant to work with exceptions passed as a parameter to it, and I need to use this view within another view. | |
Mar 25, 2015 at 19:16 | comment | added | Doval |
@RobertHarvey Exceptions are idiomatic in Python; for instance that's how for loops know to stop iterating (unlike e.g. Java's iterators that query hasNext ). There's no such stigma in Standard ML either, but they don't include stack traces in that language (unless you ask the compiler in some compiler-specific way) so the cost of throwing them is much lower.
|
|
Mar 25, 2015 at 19:12 | review | Close votes | |||
Mar 26, 2015 at 16:22 | |||||
Mar 25, 2015 at 19:09 | answer | added | user40980 | timeline score: 4 | |
Mar 25, 2015 at 18:59 | comment | added | Bart van Ingen Schenau | @gnat: Note that in this Q nowhere the exception is used to affect the control flow. It is rather the reverse: showing information from an Exception object that wasn't thrown at all. | |
Mar 25, 2015 at 18:56 | comment | added | Bart van Ingen Schenau | @php_nub_qq: Can you explain your usecase where you need to render an exception that wasn't thrown? | |
S Mar 25, 2015 at 18:54 | history | suggested | SurrealSyntax | CC BY-SA 3.0 |
trying to clarify the question and adding more tags to make it more specific.
|
Mar 25, 2015 at 18:53 | comment | added | Robert Harvey | I just don't see what the point of the exception is, especially if you can render the error in the usual way. | |
Mar 25, 2015 at 18:48 | review | Suggested edits | |||
S Mar 25, 2015 at 18:54 | |||||
Mar 25, 2015 at 18:47 | comment | added | php_nub_qq | @RobertHarvey So you would advise against my current approach? | |
Mar 25, 2015 at 18:46 | comment | added | Robert Harvey | Throwing an exception without an exceptional condition is a bad practice in any programming language. Java doesn't prevent you from doing it. | |
Mar 25, 2015 at 18:46 | comment | added | php_nub_qq | @RobertHarvey is what I've done considered bad practice, because in java it would be, if possible at all. | |
Mar 25, 2015 at 18:43 | comment | added | Robert Harvey | Since an exception can be thrown any time you feel like it, the obvious answer to "[are exceptions thrown] only if something really critical has happened?" is "No." Exceptions can be abused just like anything else. | |
Mar 25, 2015 at 18:42 | history | asked | php_nub_qq | CC BY-SA 3.0 |