Improve error responses

- Send error code when there's an error
- Also include a message in the json
- Allows errors to be handled consistently on client