Idea:
Add an option to extend a internal global error handler and response envelope wrapper.
This basically wraps the response into a wrapper and automatically takes care of the error and how's it wrapped into json.
Like wise for success responses too.