INNER CODE UNIT · Python

InvalidFileFormatError

koxudaxi/datamodel-code-generator · src/datamodel_code_generator/__init__.py:619

class InvalidFileFormatError(Error):
    """Raised when the input file format is invalid or cannot be parsed."""

    def __init__(
        self,
        original_error: Exception,
        input_file_type: InputFileType | None = None,
        *,
        source: str | Path | None = None,
    ) -> None:
        """Initialize with original error, input file type, and source context."""
        self.original_error = original_error
        self.input_file_type = input_file_type
        self.source = source
        error_detail = f"{type(original_error).__name__}: {original_error}"
        source_detail = f" at {source}" if source is not None else ""
        if input_file_type is not None:
            message = f"Invalid file format for {input_file_type.value}{source_detail}: {error_detail}"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…