from shared.workflows.errors import ProviderAPIError, WorkflowExecutionError def create_error_message(e: Exception) -> str: """Create an error message for a given exception.""" if isinstance(e, ProviderAPIError): return f"Our {e.provider} models are currently experiencing issues. Please try again later. \n\nIf the problem persists, please contact support." elif isinstance(e, WorkflowExecutionError): return f"Workflow execution failed: {e}. Please try again later. \n\nIf the problem persists, please contact support." elif isinstance(e, ValueError): return f"Invalid input -- {e}. Please try again. \n\nIf the problem persists, please contact support." else: return "An unexpected error occurred. Please contact support."