make sure to send error code to the response status code