Skip to content

errors2

errors2

Base error classes used in this module.

Parser2Error

Bases: ValueError

Base class for parser errors.

Exceptions derived from this exception are exclusively raised in PyGerber's Gerber X3 Parser. This exception can be used in try: ... except Parser2Error: ... block to catch all exceptions raised by Parser while allowing other exceptions to interrupt execution.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class Parser2Error(ValueError):
    """Base class for parser errors.

    Exceptions derived from this exception are exclusively raised in PyGerber's Gerber
    X3 Parser. This exception can be used in
    `#!python try: ... except Parser2Error: ...` block to catch all exceptions
    raised by Parser while allowing other exceptions to interrupt execution.
    """

    def get_message(self) -> str:
        """Get parser error help message."""
        return f"{self.__class__.__qualname__}: {self.__doc__}"

get_message

get_message() -> str

Get parser error help message.

Source code in src/pygerber/gerberx3/parser2/errors2.py
def get_message(self) -> str:
    """Get parser error help message."""
    return f"{self.__class__.__qualname__}: {self.__doc__}"

ZeroOmissionNotSupported2Error

Bases: Parser2Error

Raised when incremental coordinates are selected. (Spec. 8.2.1.2).

Source code in src/pygerber/gerberx3/parser2/errors2.py
class ZeroOmissionNotSupported2Error(Parser2Error):
    """Raised when incremental coordinates are selected. (Spec. 8.2.1.2)."""

IncrementalCoordinatesNotSupported2Error

Bases: Parser2Error

Raised when incremental coordinates are selected. (Spec. 8.2.1.2).

Source code in src/pygerber/gerberx3/parser2/errors2.py
class IncrementalCoordinatesNotSupported2Error(Parser2Error):
    """Raised when incremental coordinates are selected. (Spec. 8.2.1.2)."""

UnsupportedCoordinateType2Error

Bases: Parser2Error

Raised for unsupported coordinate types.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class UnsupportedCoordinateType2Error(Parser2Error):
    """Raised for unsupported coordinate types."""

InvalidCoordinateLength2Error

Bases: Parser2Error

Raised when coordinate string is too long.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class InvalidCoordinateLength2Error(Parser2Error):
    """Raised when coordinate string is too long."""

ParserFatal2Error

Bases: Parser2Error

Raised when parser encounters fatal failure from non-parser specific exception.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class ParserFatal2Error(Parser2Error):
    """Raised when parser encounters fatal failure from non-parser specific
    exception.
    """

OnUpdateDrawingState2Error

Bases: Parser2Error

Raised when parser encounters fatal failure from non-parser specific exception during call to .update_drawing_state() call.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class OnUpdateDrawingState2Error(Parser2Error):
    """Raised when parser encounters fatal failure from non-parser specific
    exception during call to .update_drawing_state() call.
    """

    def __init__(self, token: Token, *args: object) -> None:
        super().__init__(*args)
        self.token = token

    def __str__(self) -> str:
        return f"{self.token} {self.token.get_token_position()}"

UnitNotSet2Error

Bases: Parser2Error

Raised when operation which requires units to be set is executed before units are set.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class UnitNotSet2Error(Parser2Error):
    """Raised when operation which requires units to be set is executed before units
    are set.
    """

ReferencedNotInitializedBlockBufferError

Bases: Parser2Error

Raised when Gerber file references block buffer which has not been initialized, ie. when block aperture was not correctly started.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class ReferencedNotInitializedBlockBufferError(Parser2Error):
    """Raised when Gerber file references block buffer which has not been
    initialized, ie. when block aperture was not correctly started.
    """

UnnamedBlockApertureNotAllowedError

Bases: Parser2Error

Raised when aperture block with no ID is encountered.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class UnnamedBlockApertureNotAllowedError(Parser2Error):
    """Raised when aperture block with no ID is encountered."""

RegionNotInitializedError

Bases: Parser2Error

Raised when region is modified without being accessed without initialization.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class RegionNotInitializedError(Parser2Error):
    """Raised when region is modified without being accessed without initialization."""

ApertureNotDefined2Error

Bases: Parser2Error

Raised when undefined aperture is selected.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class ApertureNotDefined2Error(Parser2Error):
    """Raised when undefined aperture is selected."""

MacroNotDefinedError

Bases: Parser2Error

Raised when undefined macro is referenced.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class MacroNotDefinedError(Parser2Error):
    """Raised when undefined macro is referenced."""

NoValidArcCenterFoundError

Bases: Parser2Error

Raised when no valid arc center point can not be deduced from IJ offset in single quadrant mode (G74).

Source code in src/pygerber/gerberx3/parser2/errors2.py
class NoValidArcCenterFoundError(Parser2Error):
    """Raised when no valid arc center point can not be deduced from IJ offset in
    single quadrant mode (G74).
    """

CoordinateFormatNotSet2Error

Bases: Parser2Error

Raised when coordinate parser is requested before coordinate format was set.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class CoordinateFormatNotSet2Error(Parser2Error):
    """Raised when coordinate parser is requested before coordinate format was set."""

ApertureNotSelected2Error

Bases: Parser2Error

Raised when attempting to use aperture without selecting it first.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class ApertureNotSelected2Error(Parser2Error):
    """Raised when attempting to use aperture without selecting it first."""

StepAndRepeatNotInitializedError

Bases: Parser2Error

Raised when step and repeat block is closed without being correctly opened.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class StepAndRepeatNotInitializedError(Parser2Error):
    """Raised when step and repeat block is closed without being correctly opened."""

MacroNotInitializedError

Bases: Parser2Error

Raised when macro statement buffer is requested without being correctly initialized.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class MacroNotInitializedError(Parser2Error):
    """Raised when macro statement buffer is requested without being correctly
    initialized.
    """

StandardAttributeError

Bases: Parser2Error

Raised when parser encounters an error while processing a standard attribute.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class StandardAttributeError(Parser2Error):
    """Raised when parser encounters an error while processing a standard attribute."""

MissingNameFieldError

Bases: StandardAttributeError

Raised when a missing name field is detected.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class MissingNameFieldError(StandardAttributeError):
    """Raised when a missing name field is detected."""

MissingGuidFieldError

Bases: StandardAttributeError

Raised when a missing name field is detected.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class MissingGuidFieldError(StandardAttributeError):
    """Raised when a missing name field is detected."""

MissingRevisionFieldError

Bases: StandardAttributeError

Raised when a missing name field is detected.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class MissingRevisionFieldError(StandardAttributeError):
    """Raised when a missing name field is detected."""

Parser2Interrupt

Bases: Exception

Base class for implementing interrupts.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class Parser2Interrupt(Exception):  # noqa: N818
    """Base class for implementing interrupts."""

ExitParsingProcess2Interrupt

Bases: Exception

Raised to stop parsing.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class ExitParsingProcess2Interrupt(Exception):  # noqa: N818
    """Raised to stop parsing."""

SkipTokenInterrupt

Bases: Exception

Raised to skip all other actions that would be performed on current token.

Source code in src/pygerber/gerberx3/parser2/errors2.py
class SkipTokenInterrupt(Exception):  # noqa: N818
    """Raised to skip all other actions that would be performed on current token."""