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:
|
||||
ui.warn( "ERROR: scm-hook failed with error code " + str(conn.code) + "\n" )
|
||||
except urllib2.URLError, e:
|
||||
msg = e.read();
|
||||
if len(msg) > 0:
|
||||
ui.warn( "ERROR: " + msg)
|
||||
msg = None
|
||||
# some URLErrors have no read method
|
||||
if hasattr(e, "read"):
|
||||
msg = e.read()
|
||||
elif hasattr(e, "code"):
|
||||
msg = "scm-hook failed with error code " + str(e.code) + "\n"
|
||||
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:
|
||||
ui.warn( "scm-hook failed with an exception\n" )
|
||||
return abort
|
||||
|
||||
Reference in New Issue
Block a user