Skip to content

# exceptions

## `xsdata.codegen.exceptions`

### `CodegenWarning`

Bases: `Warning`

Recovered errors during code generation recovered errors.

Source code in `xsdata/codegen/exceptions.py`

    6
    7

    class CodegenWarning(Warning):
        """Recovered errors during code generation recovered errors."""

### `CodegenError`

Bases: `ClickException`

Unexpected state during code generation related errors.

Source code in `xsdata/codegen/exceptions.py`

    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    class CodegenError(ClickException):
        """Unexpected state during code generation related errors."""

        def __init__(self, message: str, **kwargs: Any):
            """Click exception constructor with metadata."""
            super().__init__(message)
            self.meta = kwargs

        def show(self, file: IO[Any] | None = None) -> None:
            """Echo codegen error message and details."""
            echo("=========")
            super().show(file)
            for key, value in self.meta.items():
                echo(f"{key}: {value}")

#### `__init__(message, **kwargs)`

Click exception constructor with metadata.

Source code in `xsdata/codegen/exceptions.py`

    13
    14
    15
    16

    def __init__(self, message: str, **kwargs: Any):
        """Click exception constructor with metadata."""
        super().__init__(message)
        self.meta = kwargs

#### `show(file=None)`

Echo codegen error message and details.

Source code in `xsdata/codegen/exceptions.py`

    18
    19
    20
    21
    22
    23

    def show(self, file: IO[Any] | None = None) -> None:
        """Echo codegen error message and details."""
        echo("=========")
        super().show(file)
        for key, value in self.meta.items():
            echo(f"{key}: {value}")