Trying again ...

The case statement for errors is pretty intense.  

You might consider creating a hash where the error code is the key and the message you want is the value.  Then have a default if it's not found.