Error Handling
from gllm_pipeline.steps._func import transform
from gllm_pipeline.steps.step_error_handler import RaiseStepErrorHandler
def may_fail(data: dict) -> str:
if not data.get("valid"):
raise ValueError("Invalid input")
return data["text"].upper()
# By default, errors will be raised with context
step = transform(
may_fail,
input_map=["text", "valid"],
output_state="result",
# error_handler=RaiseStepErrorHandler() # 👈 This is the default
)Error in Transform 'Transform_may_fail__abc123' during execution.
Error type: ValueError. Original error: Invalid inputError Handling Strategies
Raise (Default)
Keep
Empty
Fallback
Error Context
Best Practices
1. Choose the Right Strategy
2. Handle Errors at the Right Level
3. Validate Critical Data Early
4. Document Error Behavior
Last updated
Was this helpful?