19

try {
// something
} catch (SomeException e) {
}

Swallowed Exception.. what the fuck is wrong with you?! And I see this shit in a lot of places in the code!

Comments
  • 2
    You forgot a little detail, that's code we got for informatics class:

    try

    {

    // something

    }

    catch (Exception e)

    {

    // ignore Exception

    }

    Yes, this shitty formatting is intended
  • 2
    What have I forgotten?
  • 1
    That's quite common. Some devs use it to interrupt the control flow from anywhere within the try-block with an exception. That avoids a few if/else or gives you a single point of return at the end for closing operations (like 'finally' in java).

    I've seen a similar approach with loops that can be left anywhere with a break-statement.

    I don't like such stuff, I think it's confusing, and before doing it that way, one should think about the design. IMO there is always a better solution than that.
  • 2
    @ddephor After some time in the industry, it seems to me that no one cares about design and everyone makes dumb decisions based on money.
  • 2
    @CaptainRant You're right.
  • 1
    Oh, I forgot something...

    The best version of that, that I've seen was using goto to abort control flow on error.

    People can be very creative...
  • 0
    @CaptainRant oh god my backend devs used to do that all the freaking time.
    "if I head the exception, then everything is going well", needless to say it didn't go well
Add Comment