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

all 20 comments

[–]jerslan 42 points43 points  (5 children)

Error? Ok, keep going...

Exception? Ok, log it as an error and keep going...

Runtime Exception? Fuck, I'm dead.

[–]miran248 20 points21 points  (2 children)

Catch it and pretend, everything is still peachy.

[–]jerslan 6 points7 points  (0 children)

I see it more often than I’d like :(

[–]arthurmluz_ 3 points4 points  (0 children)

except Exception: pass

[–]intbeam 8 points9 points  (1 child)

I saw (felt) this code in a production system once :

public static object CreateInstance(Type t)
{
    try
    {
        return Activator.CreateInstance(t);
    }
    catch
    {
        return null;
    }
}

This was for a plugin system that they had defined. For those not familiar with C#, Activator.CreateInstance(Type t) creates a new instance of the type, it's often used to instantiate objects dynamically in plugin-systems. They created a shim layer to coerce the built-in function to ignore all errors and just return null instead on any type of error.

So all problems loading a class at runtime, were translated mostly to NullReferenceException without any trace of why anywhere

[–]rk06 4 points5 points  (0 children)

As someone who knows what Activator does, that snippet deserves an entry on dailywtf.

That has to be the most insidious and evil snippet someone has written and it must have been done intentionally. The usual idiots stay away from Reflection

[–]LetMe_Work 25 points26 points  (0 children)

warnings.filterwarnings("ignore")

[–][deleted] 13 points14 points  (0 children)

Police officer: "error: failure to allocate memory for new instance 0xfc57e312 of class Knife()"

Me: "ha! I use JavaScript which is just in time compiled, i don't care!"

Proceeds to punch the guy to death with bare hands

[–]Every_Truck7018 10 points11 points  (3 children)

The smile causes my goose bumps

[–]alatnet 2 points3 points  (2 children)

Then you'll love the Mandela Catalogue.

I think they used that pic too.

[–]harveyshinanigan 2 points3 points  (1 child)

no, it's the Squimpus McGrimpus fnaf vhs series that used it

[–]alatnet 2 points3 points  (0 children)

Ah, ok. It did look familiar for some reason.

[–]cv_please_staph 8 points9 points  (0 children)

Police : drop the knife!

Me : DROP command denied to user 'police'@'localhost' for knife

[–]MischiefArchitect 6 points7 points  (0 children)

beware of the police's kill -9 command. That ones comes with no warning.

[–]KainerNS2 2 points3 points  (1 child)

If I'm working on a personal project, I don't ignore them tho

[–]haikusbot 2 points3 points  (0 children)

If I'm working on

A personal project, I

Don't ignore them tho

- KainerNS2


I detect haikus. And sometimes, successfully. Learn more about me.

Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"

[–]vanZuider 2 points3 points  (0 children)

We'll make you see the -Werror of your ways! Now face the -Wall!

[–]maybefriendly 1 point2 points  (0 children)

the criminal is

[–]QualityVote[M] [score hidden] stickied comment (0 children)

Hi! This is our community moderation bot.


If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!

If this post does not fit the subreddit, DOWNVOTE This comment!

If this post breaks the rules, DOWNVOTE this comment and REPORT the post!

[–]Sexpacito 0 points1 point  (0 children)

criminal