Commit c2b4cb75 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[bin][runcommand] outsource error hints

parent 87c384c5
......@@ -4,6 +4,14 @@ import functools
import subprocess
def getCommandErrorHints(command):
if "git " in command:
return "It seems that a git command failed. Please check:\n" \
" -- is the module registered as git repository?\n" \
" -- is upstream defined for the branch?"
return None
# execute a command and retrieve the output
def runCommand(command, suppressTraceBack=False, errorMessage=''):
try:
......@@ -18,11 +26,9 @@ def runCommand(command, suppressTraceBack=False, errorMessage=''):
print("-- command: {}".format(command))
print("-- folder: {}".format(os.getcwd()))
print("-- error: {}".format(sys.exc_info()[1]))
if "git " in command:
print()
print("It seems that a git command failed. Please check:\n"
" -- is the module registered as git repository?\n"
" -- is upstream defined for the branch?\n")
hints = getCommandErrorHints(command)
if hints is not None:
print(hints)
raise
else:
raise Exception(errorMessage)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment