如何获取DownloadError的详细信息?
我执行以下操作:
try:
result = urlfetch.fetch(url=some_url,
...
except DownloadError:
self.response.out.write('DownloadError')
logging.error('DownloadError')
except Error:
self.response.out.write('Error')
logging.error('Error')
有什么方法可以获得有关所发生事件的更详细描述吗?
I do the following:
try:
result = urlfetch.fetch(url=some_url,
...
except DownloadError:
self.response.out.write('DownloadError')
logging.error('DownloadError')
except Error:
self.response.out.write('Error')
logging.error('Error')
Is there any way to get some more detailed description on what happened?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用
logging.exception
将异常添加到错误日志消息中:You should use
logging.exception
to add the Exception to the ERROR logging message:简而言之,不。根据我们的经验,下载错误通常是超时 - 后端响应时间过长(第一个字节)。如果它正在接收数据,看起来 GAE 会等待并在 10 秒结束后抛出一个 Deadline 异常。
它曾经成功吗?您对如何处理提单异常的选择将根据后端的不同而有所不同。
如果您采用简单的路线并只是重试,请注意配额和限制器 - 很可能您的请求确实已到达其他系统,但没有及时返回。通过这种方式很容易突破限制。
J
In short, no. A download error is usually a timeout in our experience - something on the back end taking too long to respond (first byte). If it is receiving data, it looks like GAE will wait and throw a Deadline exception instead after your 10 seconds is up.
Does it ever succeed? Your choices on how to deal with d/l exceptions will vary depending on the back-end.
If you're taking the simplistic route and just retrying, beware of quotas and limiters - chances are your requests are indeed reaching the other system, and just aren't coming back in time. Very easy to blow past limiters this way.
J