Exceptions#

class caskade.CaskadeException[source]#

Bases: Exception

Base class for all exceptions in caskade.

All custom exceptions raised by caskade inherit from this class, allowing users to catch any caskade-specific error with a single except clause.

class caskade.GraphError[source]#

Bases: CaskadeException

Exception for graph-related errors in caskade.

Raised when an operation on the computational graph is invalid, such as creating cycles or referencing nonexistent nodes.

class caskade.BackendError[source]#

Bases: CaskadeException

Exception for backend-related errors in caskade.

Raised when the selected numerical backend encounters an unsupported operation or configuration issue.

class caskade.LinkToAttributeError[source]#

Bases: GraphError

Exception raised when linking to an attribute fails.

Raised when an attempt is made to create a link to a node attribute that does not exist or is not a valid link target.

class caskade.NodeConfigurationError[source]#

Bases: CaskadeException

Exception for node configuration errors in caskade.

Raised when a node is configured with invalid or incompatible settings.

class caskade.ParamConfigurationError[source]#

Bases: NodeConfigurationError

Exception for parameter configuration errors in caskade.

Raised when a parameter is defined with an invalid shape, type, or constraint.

class caskade.ParamTypeError[source]#

Bases: CaskadeException

Exception for parameter type errors in caskade.

Raised when a value assigned to a parameter does not match its expected type.

class caskade.ActiveStateError[source]#

Bases: CaskadeException

Exception for active-state errors in caskade.

Raised when an operation requires a node to be in a particular active state (enabled or disabled) and that condition is not met.

class caskade.FillParamsError[source]#

Bases: CaskadeException

Base exception for errors when filling parameters in caskade.

Raised when the input data provided to fill node parameters is invalid. Subclasses handle specific input types (array, sequence, mapping).

class caskade.FillParamsArrayError(name, input_params, params)[source]#

Bases: FillParamsError

Exception raised when filling parameters with an array fails.

Raised when the shape of the input array does not match the total number of flattened parameters registered on a node.

Parameters:
  • name (str) – Name of the node whose parameters are being filled.

  • input_params (ArrayLike) – The input array that was provided.

  • params (tuple of Param) – Registered parameters whose shapes are compared against the input.

class caskade.FillParamsSequenceError(name, input_params, dynamic_params)[source]#

Bases: FillParamsError

Exception raised when filling parameters with a sequence fails.

Raised when the length of the input sequence does not match the number of dynamic parameters registered on a node.

Parameters:
  • name (str) – Name of the node whose parameters are being filled.

  • input_params (sequence) – The input sequence (list, tuple, etc.) that was provided.

  • dynamic_params (tuple of Param) – Registered dynamic parameters expected by the node.

class caskade.FillParamsMappingError(name, children, missing_key=None)[source]#

Bases: FillParamsError

Exception raised when filling parameters with a mapping fails.

Raised when a key in the input dictionary does not correspond to any registered child node.

Parameters:
  • name (str) – Name of the node whose parameters are being filled.

  • children (dict) – Dictionary of registered child nodes.

  • missing_key (str, optional) – The key from the input mapping that was not found among the node’s children.