Add feature to change http status code on error

Right now, the endpoints always return 400 response HTTP status code when the API method returns an error.
I want to return the suitable response code on error.