madaxeman

October 27, 2016

I Take Exception

Filed under: Uncategorized — madaxeman @ 3:15 pm

Right then – techie time…

There is a special circle of hell for people who think it’s a good idea to throw instances of the System.Exception class, and I am going to make it my mission in life to ensure they find there way to it. What am I talking about? This:

throw new Exception(“Some wittering message”);

What’s wrong with it?

The biggest problem is that should I decide I actually care about your wittering exception, I am unable to catch it directly… Sure, I can write the catch block, but what happens if another type of exception is thrown within the try block? Chaos ensues… Even if I do catch it, how am I supposed to know what to do – lacking a custom exception class as it does I have no idea as a developer what you are claiming happened, and therefore how I might respond to it…

If you are going to mark yourself out for my fury, you need to know that I don’t give a shite about the text you pass in the message – only idiots make buisness decisions on natural language text like that.

What should you be doing then if you want to remain my friend? Simplez – declare your own Exception class and inherit from either System.Exception or System.ApplicationException. It’s not exactly a time consuming task, it gives me confidence that when I catch the exception we are talking about the same thing, and it allows you to pass information to me, the innocent victim of your code, in a structured manner that I can use to decide what to do…

I’m sorry, but I’m sick and tired of this crap. Sort it the fook out.

NOW!

Advertisements

Create a free website or blog at WordPress.com.