Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • There's one bad consequence, at least in languages providing a full stack trace. As the code is heavily optimized with a lot of inlining, the real stack trace and the one a developer wants to see differ a lot and therefore the stack trace generation is costly. Overusing exceptions is very bad for performance in such languages (Java, C#). Commented Jan 6, 2017 at 4:03
  • "It's a poor way to do things" - Shouldn't that be enough to classify it as an anti-pattern? Commented Apr 5, 2018 at 6:30
  • 1
    @Maybe_Factor Per the definition of an ant-pattern, no. Commented Apr 6, 2018 at 17:31
  • @MirroredFate i like how you separated the problem it solves from the negatives. i think this is a pretty good. except for the last section about anti-pattern. you could mention lower performance as a negative consequence. you could also give a concrete example of exception as control flow, so that we are all on the same page. you could even give an example of exceptions fixing the the arrow anti-pattern, before the last section Commented Nov 17, 2022 at 8:09
  • There are two exceptions, low level and high-level. A low level exception is one thrown by a file or keyboard io function further down the stack, for instance. A high level one catches a lower level one and rethrows it as is, or rethrows it with a more specific or detailed message which can be presented to the user. High level exceptions can be abused, but they are the best way of meaningfully reporting errors. Commented Aug 13, 2023 at 3:44