Skip to content

Commit feb4153

Browse files
committed
fix(foundry): preserve workflow failure causes
1 parent 176281a commit feb4153

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/cas_reference_product/workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def run(self, envelope: PromptEnvelope) -> str:
5656
}
5757
},
5858
)
59-
except Exception:
60-
raise WorkflowAgentServiceError("Foundry workflow invocation failed") from None
59+
except Exception as error:
60+
raise WorkflowAgentServiceError("Foundry workflow invocation failed") from error
6161
return response.output_text
6262

6363

tests/test_service_factory.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,10 @@ def test_foundry_service_sanitizes_sdk_failure(envelope: "Any") -> None:
8888
)
8989
service = FoundryWorkflowAgentService(settings)
9090

91-
with pytest.raises(WorkflowAgentServiceError, match="Foundry workflow invocation failed"):
91+
with pytest.raises(
92+
WorkflowAgentServiceError, match="Foundry workflow invocation failed"
93+
) as caught:
9294
service.run(envelope)
95+
96+
assert isinstance(caught.value.__cause__, RuntimeError)
97+
assert str(caught.value.__cause__) == "sensitive provider detail"

0 commit comments

Comments
 (0)