robustcheckout: log details of unhandled exception (bug 1371378); r?sheehan draft
authorGregory Szorc <gps@mozilla.com>
Thu, 22 Mar 2018 17:25:39 -0700
changeset 12189 119bbba32457c1ddbdc61dce7600841c0708c83f
parent 12188 574bdaed8e63f1855971048525eea5bd55b01b8d
child 12190 7f9fa46f29f15c805ef3f13b27194f7ba4cacf08
push id1913
push userbmo:gps@mozilla.com
push dateFri, 23 Mar 2018 00:25:49 +0000
reviewerssheehan
bugs1371378
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
hgext/robustcheckout/__init__.py
--- 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