exceptions#

Exception classes for GAMSPy

exception gamspy.exceptions.EngineClientException[source]#

Bases: GamspyBaseException

EngineClient exception

exception gamspy.exceptions.EngineException(message: str, return_code: int, status_code: int | None = None)[source]#

Bases: GamspyException

GAMS Engine execution exception.

Parameters:
messagestr
return_codeint
status_codeint | None, optional
exception gamspy.exceptions.FatalError[source]#

Bases: GamspyBaseException

Indicates an error that cannot be recovered from. This error should never be caught.

exception gamspy.exceptions.GamspyBaseException[source]#

Bases: Exception

Base class of every exception GAMSPy raises.

Catch this to handle any GAMSPy failure without enumerating the individual exception types:

try:
    model.solve()
except GamspyBaseException as e:
    ...

It does not carry any behavior of its own, so no subclass is forced to accept a particular constructor signature. Prefer a narrower type when you know which failure you want to handle.

exception gamspy.exceptions.GamspyException(message: str, return_code: int | None = None)[source]#

Bases: GamspyBaseException

An error raised while GAMS executed the generated model. This exception can be caught and GAMSPy should be able to continue. It deliberately does not cover validation, GDX or client errors; catch GamspyBaseException for those as well.

Parameters:
messagestr
return_codeint | None
exception gamspy.exceptions.GdxException[source]#

Bases: GamspyBaseException

GDX exception

exception gamspy.exceptions.GmdException[source]#

Bases: GamspyBaseException

GMD exception

exception gamspy.exceptions.LatexException(message: str, return_code: int | None = None)[source]#

Bases: GamspyException

To latex execution exception

exception gamspy.exceptions.NeosClientException[source]#

Bases: GamspyBaseException

NeosClient exception

exception gamspy.exceptions.NeosException(message: str, return_code: int | None = None)[source]#

Bases: GamspyException

NEOS Server execution exception

exception gamspy.exceptions.ValidationError[source]#

Bases: GamspyBaseException

An error while validating data.