def test_sync_workflow_error_handling(exporter):
    """Test error handling in synchronous workflow"""
    error_message = "Intentional workflow test error"

    @workflow(name="failing_workflow")
    def failing_workflow():
        raise ValueError(error_message)

    with pytest.raises(ValueError, match=error_message):
        failing_workflow()

    spans = exporter.get_finished_spans()
    assert len(spans) == 1

    workflow_span = spans[0]
    assert workflow_span.name == "failing_workflow.workflow"
    assert workflow_span.status.status_code == StatusCode.ERROR
    assert error_message in workflow_span.status.description
Test error handling in synchronous workflow
packages/traceloop-sdk/tests/test_workflows.py