Added better error reporting in the HTTP API so its easier to debug.