Added code to send error message to stderr if request has an error.