INNER CODE UNIT · Python
_require
gokayfem/ComfyUI-fal-API · nodes/builder_node.py:77
def _require(node_name: str, field: str, value: str) -> str:
"""Strip a required string field, raising when it is blank."""
text = (value or "").strip()
if not text:
raise FalApiError(node_name, f"'{field}' is required and cannot be empty")
return text
def _resolve_image_url(node_name: str, field: str, image: Any, url: str, required: bool) -> str:
"""A connected IMAGE wins (uploaded via fal storage); else the URL string."""
if image is not None:
return ImageUtils.upload_image(image)
text = (url or "").strip()
if not text and required:
raise FalApiError(
node_name,
f"Connect an image or fill '{field}': the schema requires an image URL",
)