```python:inference/core/interfaces/http/error_handlers.py
from inference.core.entities.responses.workflows import WorkflowErrorResponse
from inference.core.workflows.errors import (StepExecutionError,
                                             WorkflowBlockError)


def _build_step_execution_error_response(
    error: StepExecutionError,
) -> "WorkflowErrorResponse":
    """Build a WorkflowErrorResponse for StepExecutionError (runtime errors)."""

    return WorkflowErrorResponse(
        message=str(error.public_message),
        error_type=error.__class__.__name__,
        context=str(error.context),
        inner_error_type=str(error.inner_error_type),
        inner_error_message=str(error.inner_error),
        blocks_errors=[
            {
                "block_id": error.block_id,
                "block_type": error.block_type,
                "property_name": "Python code",
                "property_details": str(error.inner_error),
                "block_traceback": error.block_traceback,
            },
        ],
    )
```