mirror of
https://github.com/langgenius/dify.git
synced 2026-02-09 23:20:12 -05:00
fix(command-node): enhance error message formatting in command execution
- Improved error message handling by assigning the stderr output to a variable for better readability. - Ensured consistent error reporting when a command fails, maintaining clarity in the output.
This commit is contained in:
@@ -111,11 +111,14 @@ class CommandNode(Node[CommandNodeData]):
|
||||
process_data = {"command": command, "working_directory": working_directory}
|
||||
|
||||
if result.exit_code not in (None, 0):
|
||||
error_message = (
|
||||
f"{result.stderr.decode('utf-8', errors='replace')}\n\nCommand exited with code {result.exit_code}"
|
||||
)
|
||||
return NodeRunResult(
|
||||
status=WorkflowNodeExecutionStatus.FAILED,
|
||||
outputs=outputs,
|
||||
process_data=process_data,
|
||||
error=f"{result.stderr.decode('utf-8', errors='replace')}\n\nCommand exited with code {result.exit_code}",
|
||||
error=error_message,
|
||||
error_type=CommandExecutionError.__name__,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user