I wrote this a while ago on my old blog, so I’m just reposting here. It’s useful since you can have an enum of error codes, which also, when converted to human readable text, are useful messages.
Here’s how I did it.
Can't see this Gist? View it on Github!