mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
use str(e) if e.read() and e.conn is not available on scmhooks.py
This commit is contained in:
@@ -59,11 +59,18 @@ def callHookUrl(ui, repo, hooktype, node):
|
|||||||
else:
|
else:
|
||||||
ui.warn( "ERROR: scm-hook failed with error code " + str(conn.code) + "\n" )
|
ui.warn( "ERROR: scm-hook failed with error code " + str(conn.code) + "\n" )
|
||||||
except urllib2.URLError, e:
|
except urllib2.URLError, e:
|
||||||
msg = e.read();
|
msg = None
|
||||||
if len(msg) > 0:
|
# some URLErrors have no read method
|
||||||
ui.warn( "ERROR: " + msg)
|
if hasattr(e, "read"):
|
||||||
|
msg = e.read()
|
||||||
|
elif hasattr(e, "code"):
|
||||||
|
msg = "scm-hook failed with error code " + str(e.code) + "\n"
|
||||||
else:
|
else:
|
||||||
ui.warn( "ERROR: scm-hook failed with error code " + str(e.getcode()) + "\n" )
|
msg = str(e)
|
||||||
|
if len(msg) > 0:
|
||||||
|
ui.warn( "ERROR: " + msg )
|
||||||
|
else:
|
||||||
|
ui.warn( "ERROR: scm-hook failed with an unknown error\n" )
|
||||||
except ValueError:
|
except ValueError:
|
||||||
ui.warn( "scm-hook failed with an exception\n" )
|
ui.warn( "scm-hook failed with an exception\n" )
|
||||||
return abort
|
return abort
|
||||||
|
|||||||
Reference in New Issue
Block a user