Set error code and error message when there is an error; Change http error code to http status code