Improve exception handling in the API
Improve exception handling in the API

API now gracefully returns a JSON based error message for all exceptions
happening within the server.

thunderboltsid/stampman