this post was submitted on 17 Jan 2025
365 points (99.2% liked)

Programmer Humor

33167 readers
433 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 20 comments
sorted by: hot top controversial new old
[–] xmunk@sh.itjust.works 92 points 2 weeks ago (3 children)

Still not as excellent as On Error Resume Next

Imagine the sheer ~~idiocy~~ genius required to add a language feature where, if an error occurred, the handling method is to just pretend that line of code never existed and continue onto the next line.

VBA is truly the language of savants.

[–] wizardbeard@lemmy.dbzer0.com 24 points 2 weeks ago

PowerShell does that by default, and it's my least favorite feature in my most used language.

$ErrorActionPreference = Stop

At the start of almost every script.

[–] intensely_human@lemm.ee -1 points 2 weeks ago (3 children)

So catching errors and doing nothing? That exists in every language except maybe BASIC?

[–] HK65@sopuli.xyz 5 points 2 weeks ago

Catching individual errors is fine. Having all errors be ignored by default is weird.

[–] locuester@lemmy.zip 2 points 2 weeks ago

Very different. This means default ignore all errors and continue to the next line. You’d have to explicitly catch every line in most(all?) other languages.

Ignoring every exception, including divisions by zero, is something I've never seen outside of BASIC and shell scripting. Even C and assembly will shit themselves when you do some of the shit that ON ERROR RESUME NEXT will ignore.

[–] DickFiasco@lemm.ee 43 points 2 weeks ago
[–] TimeSquirrel@kbin.melroy.org 30 points 2 weeks ago

Like putting electrical tape over your check engine light.

[–] konalt@lemmy.world 30 points 2 weeks ago (1 children)

I wrap every line of code in a try catch block, even my try catch blocks are in try catch blocks just in case the first accidentally drops it after catching it

[–] CaptainBlagbird@lemmy.world 8 points 2 weeks ago

Yo dawg, I heard you like try-catch blocks

[–] 30p87@feddit.org 25 points 2 weeks ago* (last edited 2 weeks ago) (1 children)
[–] missphant@lemmy.blahaj.zone 7 points 2 weeks ago
process.on('uncaughtException', console.error)
[–] Bosht@lemmy.world 15 points 2 weeks ago

That's fucking hilarious

[–] cypherpunks@lemmy.ml 12 points 2 weeks ago

except: pass

Donald Trump does coding.

[–] FiniteLooper@lemm.ee 6 points 2 weeks ago

I came across a stack overflow recently about how to do something in a jasmine unit test. Someone gave a solution of “I just changed the test to xit(“… and now there are no errors!”

[–] devilish666@lemmy.world 5 points 2 weeks ago

Push it to prod & see the world burns around you

[–] Pickle_Jr@lemmy.dbzer0.com 5 points 2 weeks ago* (last edited 2 weeks ago)

It works on their machine though!

[–] art_codesmith@toot.cafe 4 points 2 weeks ago

@Irelephant "Fixed dem warnings boss."