Error Handling
This is a simple widget that demonstrates how to handle errors in your widgets.
We display the error detail message in the markdown widget that is returned from the endpoint.

@register_widget({
"name": "Markdown Widget with Error Handling",
"description": "A markdown widget with error handling",
"type": "markdown",
"endpoint": "markdown_widget_with_error_handling",
"gridData": {"w": 12, "h": 4},
})
@app.get("/markdown_widget_with_error_handling")
def markdown_widget_with_error_handling():
"""Returns a markdown widget with error handling"""
raise HTTPException(
status_code=500,
detail="Error that just occurred"
)