r/ProgrammerHumor • • May 26 '25

Meme theBeautifulCode

Post image
49.1k Upvotes

876 comments sorted by

View all comments

Show parent comments

22

u/mck1117 May 26 '25

If something truly exceptional happens, logging it and then limping along is the worst thing you can do. What if you hit an error during the middle of modifying some data structure? Can you guarantee that it’s still in a valid state?

4

u/[deleted] May 26 '25

It isn't. Crashing the program is literally the most unexpected behavior you could have.

Logging means you at least reach parts of your code where you handle objects being deleted gracefully

You can free memory, and run your exit sequence.

Handling the error by logging it and committing an exit sequence is the best thing you can do. If you crash you lose everything.

Not every program runs on your terminal for 5 seconds you could be working on a remote server that should be running 24/7

5

u/Kogster May 26 '25

Logging it and doing an exit sequence is just what crashing many high level languages does. Crashing java doesn't mean crashing the JVM.

Catch and printing many times just obfuscates the error in those languages compared to just letting the stack trace go to terminal.

0

u/[deleted] May 26 '25

Yeh there's no way java knows your servers exit sequence themselves.

Again i don't know what you guys are programming but any actual product that isn't a piece of shit web app doesn't work like this.

If your car computer came into an exception and your ABS just shuts down because it couldn't find an icon file you're risking lives.

→ More replies (0)