Improve error reporting for xhr.