Add error messages to response, check for correct placement of response_code and return it