mirror of
https://github.com/langgenius/dify.git
synced 2026-01-22 03:32:58 +08: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:
parent
1fbba38436
commit
0d33714f28
@ -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__,
|
||||
)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user