common.sh: Adjust formatting in msg_on_error() and add stack trace

This commit is contained in:
Kamil Śliwak 2021-10-14 16:50:14 +02:00
parent b85172b055
commit 3b1b9a0bfb

View File

@ -138,24 +138,30 @@ function msg_on_error()
rm "$stdout_file" "$stderr_file" rm "$stdout_file" "$stderr_file"
return 0 return 0
else else
printError "Command failed: $SOLC ${command[*]}" printError ""
printError "Command failed: ${error_message}"
printError " command: $SOLC ${command[*]}"
if [[ -s "$stdout_file" ]] if [[ -s "$stdout_file" ]]
then then
printError "stdout:" printError "--- stdout ---"
printError "-----------"
>&2 cat "$stdout_file" >&2 cat "$stdout_file"
printError "--------------"
else else
printError "stdout: <EMPTY>" printError " stdout: <EMPTY>"
fi fi
if [[ -s "$stderr_file" ]] if [[ -s "$stderr_file" ]]
then then
printError "stderr:" printError "--- stderr ---"
>&2 cat "$stderr_file" >&2 cat "$stderr_file"
printError "--------------"
else else
printError "stderr: <EMPTY>" printError " stderr: <EMPTY>"
fi fi
printError "$error_message"
rm "$stdout_file" "$stderr_file" rm "$stdout_file" "$stderr_file"
printStackTrace
return 1 return 1
fi fi
} }