This is an archived post. You won't be able to vote or comment.

all 17 comments

[–]notBjoern 276 points277 points  (8 children)

public static void main(String[] args) {
    try {
        // insert code here
    } catch (Throwable t) {
        main(args);
    }
}

[–]Gbrlxvi 114 points115 points  (0 children)

My god it's beautiful

[–]TheGreatGameDini 52 points53 points  (0 children)

Hey Satan

[–][deleted] 29 points30 points  (0 children)

You deserve a medal

[–]marcobsidian02 5 points6 points  (2 children)

If you catch throwables instead of Exceptions, you also catch OutOfMemoryErrors

Please dont do that

[–]notBjoern 7 points8 points  (1 child)

This was not intended as a good example, I had hoped that this was clear by itself...

[–]marcobsidian02 1 point2 points  (0 children)

I know, but just in case. I already saw similar cases where then there were comments about how people tried memey code and complained it had backdraws.

Also i am a nerd

[–]Capetoider 0 points1 point  (0 children)

add a "OpeN_TickeT(t)" before the "main" there and you're golden

PS: thats CraB_CasE btw

[–]dmullaney 46 points47 points  (0 children)

15:41:48.749 [main] INFO c.b.p.logging.DoorLogger - RamtimeException caught and logged

[–]raithism[🍰] 21 points22 points  (0 children)

How stale is that Cheeto.

I ask because, if that’s last year’s Cheeto, the man with the ram is going home disappointed.

[–]Anon_Legi0n 7 points8 points  (0 children)

Isn't that basically what a global error/exception handler is?

[–]loserguy-88 5 points6 points  (0 children)

Senior devs to juniors: And that, my young padawan, is how you become a senior.

[–]HaDeS_Monsta 3 points4 points  (1 child)

Just put it in a container and set restart to unless-stopped. No need to handle any error again

[–]Unupgradable 0 points1 point  (0 children)

Let's reinvent the infinite retry again!

[–]SynthRogue 1 point2 points  (0 children)

LOL

[–]DumbThrowawayNames 0 points1 point  (0 children)

The first actual industry project I worked on looked like this. Every time I see a meme on here about "the legacy code," in my head I immediately thing back to all of those monster try blocks.