Remsky's picture
Add initial project structure with Docker support and UI components
599abe6
def style_error(message: str) -> str:
"""
Style an error message with a muted red background and border.
Args:
message: The error message to style
Returns:
str: HTML-formatted error message with styling
"""
return f"""
<div style="padding: 1rem;
border-radius: 0.5rem;
background-color: #fee2e2;
border: 1px solid #ef4444;
margin: 1rem 0;">
<p style="color: #dc2626; margin: 0;">🎭 {message}</p>
</div>
"""
def format_error(error: Exception, prefix: str = "") -> str:
"""
Format an exception into a user-friendly error message.
Args:
error: The exception to format
prefix: Optional prefix for the error message
Returns:
str: Styled error message
"""
error_msg = str(error)
if len(error_msg) > 100:
error_msg = error_msg[:100] + "..."
if prefix:
error_msg = f"{prefix}: {error_msg}"
return style_error(error_msg)