from pathlib import Path


def load_if_exists(filepath: Path) -> str:
    """If a file exists, return its contents, otherwise raise an error."""
    if not filepath.exists():
        raise ValueError(f"Could not locate source file: '{filepath}'")

    return filepath.read_text()