Skip to content

Python API: Conversion: errors

tina_mgr.convert.formats.f_base.FormatError dataclass

Bases: Error, ValueError

An error generated by a format handler.

Source code in python/src/tina_mgr/convert/formats/f_base.py
@dataclasses.dataclass
class FormatError(defs.Error, ValueError):
    """An error generated by a format handler."""

tina_mgr.convert.formats.f_base.DeserializationError dataclass

Bases: FormatError

An error that occurred while deserializing some data.

Source code in python/src/tina_mgr/convert/formats/f_base.py
@dataclasses.dataclass
class DeserializationError(FormatError):
    """An error that occurred while deserializing some data."""

    # It turns out PyYAML's YAMLError is not a ValueError
    err: Exception
    """The deserialization error that occurred."""

    def __str__(self) -> str:
        """Provide a human-readable description of the error."""
        return f"Could not deserialize a Tina database: {self.err}"

err: Exception instance-attribute

The deserialization error that occurred.

__str__()

Provide a human-readable description of the error.

Source code in python/src/tina_mgr/convert/formats/f_base.py
def __str__(self) -> str:
    """Provide a human-readable description of the error."""
    return f"Could not deserialize a Tina database: {self.err}"

tina_mgr.convert.formats.f_base.NoFormatVersionError dataclass

Bases: FormatError

The serialized database does not declare its format version.

Source code in python/src/tina_mgr/convert/formats/f_base.py
@dataclasses.dataclass
class NoFormatVersionError(FormatError):
    """The serialized database does not declare its format version."""

    def __str__(self) -> str:
        """Provide a human-readable description of the error."""
        return "Missing format.version.major/minor fields"

__str__()

Provide a human-readable description of the error.

Source code in python/src/tina_mgr/convert/formats/f_base.py
def __str__(self) -> str:
    """Provide a human-readable description of the error."""
    return "Missing format.version.major/minor fields"

tina_mgr.convert.formats.f_base.UnsupportedFormatVersionError dataclass

Bases: FormatError

The serialized database specifies an invalid format version.

Source code in python/src/tina_mgr/convert/formats/f_base.py
@dataclasses.dataclass
class UnsupportedFormatVersionError(FormatError):
    """The serialized database specifies an invalid format version."""

    major: int
    """The major version number."""

    minor: int
    """The minor version number."""

    def __str__(self) -> str:
        """Provide a human-readable description of the error."""
        return f"Unsupported format version {self.major}.{self.minor}"

major: int instance-attribute

The major version number.

minor: int instance-attribute

The minor version number.

__str__()

Provide a human-readable description of the error.

Source code in python/src/tina_mgr/convert/formats/f_base.py
def __str__(self) -> str:
    """Provide a human-readable description of the error."""
    return f"Unsupported format version {self.major}.{self.minor}"

tina_mgr.convert.formats.f_base.NoTinaError dataclass

Bases: FormatError

The serialized database does not contain a 'tina' element.

Source code in python/src/tina_mgr/convert/formats/f_base.py
@dataclasses.dataclass
class NoTinaError(FormatError):
    """The serialized database does not contain a 'tina' element."""

    def __str__(self) -> str:
        """Provide a human-readable description of the error."""
        return "Missing 'tina' field"

__str__()

Provide a human-readable description of the error.

Source code in python/src/tina_mgr/convert/formats/f_base.py
def __str__(self) -> str:
    """Provide a human-readable description of the error."""
    return "Missing 'tina' field"

tina_mgr.convert.formats.f_base.NoTinaListError dataclass

Bases: FormatError

The 'tina' element is of some weird type.

Source code in python/src/tina_mgr/convert/formats/f_base.py
@dataclasses.dataclass
class NoTinaListError(FormatError):
    """The 'tina' element is of some weird type."""

    def __str__(self) -> str:
        """Provide a human-readable description of the error."""
        return "The 'tina' field must be a list of dicts"

__str__()

Provide a human-readable description of the error.

Source code in python/src/tina_mgr/convert/formats/f_base.py
def __str__(self) -> str:
    """Provide a human-readable description of the error."""
    return "The 'tina' field must be a list of dicts"

tina_mgr.convert.formats.f_base.NoFieldError dataclass

Bases: FormatError

An item is missing a required field.

Source code in python/src/tina_mgr/convert/formats/f_base.py
@dataclasses.dataclass
class NoFieldError(FormatError):
    """An item is missing a required field."""

    name: str
    """The name of the missing field."""

    def __str__(self) -> str:
        """Provide a human-readable description of the error."""
        return f"Database item with no {self.name} field"

name: str instance-attribute

The name of the missing field.

__str__()

Provide a human-readable description of the error.

Source code in python/src/tina_mgr/convert/formats/f_base.py
def __str__(self) -> str:
    """Provide a human-readable description of the error."""
    return f"Database item with no {self.name} field"

tina_mgr.convert.formats.f_base.InvalidTypeFieldError dataclass

Bases: FormatError

An item has a field of an invalid type.

Source code in python/src/tina_mgr/convert/formats/f_base.py
@dataclasses.dataclass
class InvalidTypeFieldError(FormatError):
    """An item has a field of an invalid type."""

    name: str
    """The name of the invalid field."""

    ftype: type[Any]
    """The type of the invalid field."""

    def __str__(self) -> str:
        """Provide a human-readable description of the error."""
        return f"Database item with a {self.name} field of invalid type {self.ftype.__name__}"

ftype: type[Any] instance-attribute

The type of the invalid field.

name: str instance-attribute

The name of the invalid field.

__str__()

Provide a human-readable description of the error.

Source code in python/src/tina_mgr/convert/formats/f_base.py
def __str__(self) -> str:
    """Provide a human-readable description of the error."""
    return f"Database item with a {self.name} field of invalid type {self.ftype.__name__}"

tina_mgr.convert.formats.f_json.JSONDeserializationError dataclass

Bases: DeserializationError

An error that occurred while deserializing a JSON object.

Source code in python/src/tina_mgr/convert/formats/f_json.py
@dataclasses.dataclass
class JSONDeserializationError(f_base.DeserializationError):
    """An error that occurred while deserializing a JSON object."""

    def __str__(self) -> str:
        """Provide a human-readable description of the error."""
        return f"Could not deserialize a JSON object: {self.err}"

__str__()

Provide a human-readable description of the error.

Source code in python/src/tina_mgr/convert/formats/f_json.py
def __str__(self) -> str:
    """Provide a human-readable description of the error."""
    return f"Could not deserialize a JSON object: {self.err}"