Patchwork [3,of,3] lfs: dump the full response on httperror in debug mode

login
register
mail settings
Submitter Matt Harbison
Date Jan. 18, 2018, 11:51 p.m.
Message ID <ace830f0f944ae48b482.1516319503@MATT7H-PC.attotech.com>
Download mbox | patch
Permalink /patch/26940/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 18, 2018, 11:51 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1516316696 18000
#      Thu Jan 18 18:04:56 2018 -0500
# Node ID ace830f0f944ae48b482e224fa8e8f557f092741
# Parent  b25b315be2f43cefdb364e52aa614ee3dcddefed
lfs: dump the full response on httperror in debug mode

This was immensely helpful in diagnosing the 500: Internal Server Error when
using workers to upload.  It's a nasty wall of html, so we really can't do
anything else with it.
Yuya Nishihara - Jan. 19, 2018, 3:14 p.m.
On Thu, 18 Jan 2018 18:51:43 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1516316696 18000
> #      Thu Jan 18 18:04:56 2018 -0500
> # Node ID ace830f0f944ae48b482e224fa8e8f557f092741
> # Parent  b25b315be2f43cefdb364e52aa614ee3dcddefed
> lfs: dump the full response on httperror in debug mode

Also queued, thanks.

> diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
> --- a/hgext/lfs/blobstore.py
> +++ b/hgext/lfs/blobstore.py
> @@ -312,6 +312,8 @@ class _gitlfsremote(object):
>                  if response:
>                      self.ui.debug('lfs %s response: %s' % (action, response))
>          except util.urlerr.httperror as ex:
> +            if self.ui.debugflag:
> +                self.ui.write('%s: %s' % (oid, ex.read()))

s/ui.write/ui.debug/ so outputs are labeled.

The format string is unchanged. I have no idea if ex.read() is terminated by
'\n'.
Matt Harbison - Jan. 19, 2018, 4:07 p.m.
> On Jan 19, 2018, at 10:14 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> 
>> On Thu, 18 Jan 2018 18:51:43 -0500, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@yahoo.com>
>> # Date 1516316696 18000
>> #      Thu Jan 18 18:04:56 2018 -0500
>> # Node ID ace830f0f944ae48b482e224fa8e8f557f092741
>> # Parent  b25b315be2f43cefdb364e52aa614ee3dcddefed
>> lfs: dump the full response on httperror in debug mode
> 
> Also queued, thanks.
> 
>> diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
>> --- a/hgext/lfs/blobstore.py
>> +++ b/hgext/lfs/blobstore.py
>> @@ -312,6 +312,8 @@ class _gitlfsremote(object):
>>                 if response:
>>                     self.ui.debug('lfs %s response: %s' % (action, response))
>>         except util.urlerr.httperror as ex:
>> +            if self.ui.debugflag:
>> +                self.ui.write('%s: %s' % (oid, ex.read()))
> 
> s/ui.write/ui.debug/ so outputs are labeled.
> 
> The format string is unchanged. I have no idea if ex.read() is terminated by
> '\n'.

Looking at the example again, it’s not. I’ll follow up unless you can amend it.

Patch

diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
--- a/hgext/lfs/blobstore.py
+++ b/hgext/lfs/blobstore.py
@@ -312,6 +312,8 @@  class _gitlfsremote(object):
                 if response:
                     self.ui.debug('lfs %s response: %s' % (action, response))
         except util.urlerr.httperror as ex:
+            if self.ui.debugflag:
+                self.ui.write('%s: %s' % (oid, ex.read()))
             raise LfsRemoteError(_('HTTP error: %s (oid=%s, action=%s)')
                                  % (ex, oid, action))