changed the error reporting

I changed the error reporting so that it's a JSON-hash containing the error-message from the raised exception.
The previous version was not working in Rails 3.2.11