Add error code to handled exceptions

When an exception is handled, it returns a 200 code by default. This creates problems in RESTful systems that are looking out for the HTTP status code.

This patch defaults any exceptions to a 500 error. If the exception has a code, then that code is used.
Merge pull request #8 from gavD/handled-exceptions-error-code

Add error code to handled exceptions