Wrapping exceptions for fun and profit

One for the programmers. (If you’re not one, look away now.)

Whenever I work on a nontrivial C# program, I usually end up writing the extension method shown at the bottom of this post. It lets me provide informative error messages when an exception bubbles up to the user, and promotes good error-handling generally. This is me sharing it with you, so you can enjoy it too.

Given an Exception, possibly containing inner exceptions, ‘ToFriendlyString()’ produces an ‘explanation’ from the chain of Exception.Messages: “This failed, because that failed, because the other failed.” Continue reading

House of Lords in Living-Up-To-Stereotype Shocker

House of Lords dining roomRecent news is that the House of Lords refused to share catering services with the House of Commons, for fear that the quality of their free food would decline—and particularly that they’d be served a lesser vintage of champagne. (Champagne wars in the Lords as peers say no to a cheaper vintage, The Observer, 7 Dec 2014)

They’ve spent about £2.6m of our tax money on champers in the last 4 years.

Meanwhile, the Red Cross is delivering emergency food in the UK for the first time since WWII, food banks are on the increase, the government has introduced swingeing austerity measures & the number of homeless families has increased by 18% in the last 4 years.

It seems immoral that we should be paying for free bubbly for the rich and privileged, when we seemly cannot afford to help the poorest out of destitution. There’s a petition to protest it on change.org.

The lords can have a glass of free champagne when the last food bank closes. I’ll buy the round.

Racism

When I was a child, I thought America was a place of racial harmony. At my school in Birmingham, (England, not Alabama) there was the average amount of racism, but on American TV shows, the U.S. seemed to my 8-year-old-eyes like a post-racial utopia: cops were always one-white, one-black; judges were invariably black women; silver-haired white guys adopted sassy black kids.

Of course, my 8-year-old self knew nothing. Continue reading

Copyright Reform

Wrote a wee letter to Vince Cable, Lord James Younger of Leckie and my MP. Possibly I shouldn’t have casually accused them of copyright infringement, but I think the other points are solid…

I was motivated to write by the campaign on Open Rights Group website. It’s an important subject. (Interesting choice of examples on it too; my MP, Tom Harris, lost his Social Media Bod post for making a ‘Downfall’ parody…)

Continue reading