Skip to content

Exceptions

Every exception gmat-run raises inherits from GmatError, so downstream code can branch on failure mode without string-parsing GMAT's log output. Leaf classes carry the payload relevant to their failure mode as attributes (attempts, log, path, value), never only as the formatted message.

GmatError

Bases: Exception

Base class for every exception raised by gmat-run.

GmatNotFoundError

GmatNotFoundError(
    attempts: Sequence[tuple[str, Path | None, str]],
)

Bases: GmatError

Raised when no usable GMAT install can be located.

The attempts attribute records each search step that ran, the path that was probed (if any), and the reason it was rejected — so callers can present a full diagnostic without re-running discovery.

GmatLoadError

Bases: GmatError

Raised when gmatpy cannot be loaded for a resolved GMAT install.

Covers unsupported Python versions (gmatpy ships per-Python-minor shared libraries), missing shared libraries, failed generation of the API startup file, and attempts to bootstrap a second install in one interpreter. The triggering ImportError or CalledProcessError is chained via __cause__.

GmatRunError

GmatRunError(message: str, log: str)

Bases: GmatError

Raised when a GMAT mission sequence fails at run time.

The log attribute carries GMAT's own stderr / log content captured during the run, so callers can surface GMAT's diagnostic verbatim without re-reading the log file.

GmatOutputParseError

GmatOutputParseError(message: str, path: Path)

Bases: GmatError

Raised when a GMAT output file cannot be parsed into a DataFrame.

The path attribute points to the offending file, so callers can inspect it or surface it in error messages without re-deriving the path.

GmatFieldError

GmatFieldError(message: str, path: str, value: Any = None)

Bases: GmatError

Raised when a dotted-path field access fails.

Covers unknown paths, type mismatches on write, and unresolvable parent objects. The path attribute carries the offending dotted-path key; the value attribute carries the value the caller attempted to write (or None for a read), verbatim.