robustcheckout: log details of unhandled exception (
bug 1371378); r?sheehan
There are various open bugs in robustcheckout where an intermittent
network failure doesn't result in a retry. Our retry logic is opt in
and the code needs to detect specific failures from exception details
in order to perform a retry.
Unfortunately, the existing command output doesn't give us sufficient
exception information to allow us to easily implement code to flag
certain exceptions for retries.
This commit adds logging of the exception type and string representation
of network-related exceptions that don't trigger retries. This will allow
us to more easily add code for detecting these exceptions.
MozReview-Commit-ID: H8McE4wc1ZU
--- a/hgext/robustcheckout/__init__.py
+++ b/hgext/robustcheckout/__init__.py
@@ -392,16 +392,22 @@ def _docheckout(ui, url, dest, upstream,
ui.warn('ssl error: %s\n' % e)
handlenetworkfailure()
return True
elif isinstance(e, urllib2.URLError):
if isinstance(e.reason, socket.error):
ui.warn('socket error: %s\n' % e.reason)
handlenetworkfailure()
return True
+ else:
+ ui.warn('unhandled URLError; reason type: %s; value: %s' % (
+ e.reason.__class__.__name__, e.reason))
+ else:
+ ui.warn('unhandled exception during network operation; type: %s; '
+ 'value: %s' % (e.__class__.__name__, e))
return False
# Perform sanity checking of store. We may or may not know the path to the
# local store. It depends if we have an existing destvfs pointing to a
# share. To ensure we always find a local store, perform the same logic
# that Mercurial's pooled storage does to resolve the local store path.
cloneurl = upstream or url