pytransc.utils.exceptions

Custom exceptions for pyTransC.

This module defines the exception hierarchy for the pyTransC package, providing specific error types for different failure modes.

 1"""Custom exceptions for pyTransC.
 2
 3This module defines the exception hierarchy for the pyTransC package,
 4providing specific error types for different failure modes.
 5"""
 6
 7
 8class PyTransCError(Exception):
 9    """Base exception class for all pyTransC-specific errors.
10
11    This is the root exception class from which all other pyTransC
12    exceptions inherit. It can be used to catch any pyTransC-related
13    error in a general exception handler.
14    """
15
16    pass
17
18
19class InputError(PyTransCError):
20    """Raised when required inputs are missing or invalid.
21
22    This exception is raised when:
23    - Required function arguments are not provided
24    - Input arrays have incompatible shapes
25    - Parameter values are outside acceptable ranges
26    - Input data types are incorrect
27
28    Parameters
29    ----------
30    msg : str, optional
31        Human-readable error message describing the input problem.
32    """
33
34    def __init__(self, msg="Invalid or missing input parameters"):
35        super().__init__(msg)
class PyTransCError(builtins.Exception):
 9class PyTransCError(Exception):
10    """Base exception class for all pyTransC-specific errors.
11
12    This is the root exception class from which all other pyTransC
13    exceptions inherit. It can be used to catch any pyTransC-related
14    error in a general exception handler.
15    """
16
17    pass

Base exception class for all pyTransC-specific errors.

This is the root exception class from which all other pyTransC exceptions inherit. It can be used to catch any pyTransC-related error in a general exception handler.

class InputError(PyTransCError):
20class InputError(PyTransCError):
21    """Raised when required inputs are missing or invalid.
22
23    This exception is raised when:
24    - Required function arguments are not provided
25    - Input arrays have incompatible shapes
26    - Parameter values are outside acceptable ranges
27    - Input data types are incorrect
28
29    Parameters
30    ----------
31    msg : str, optional
32        Human-readable error message describing the input problem.
33    """
34
35    def __init__(self, msg="Invalid or missing input parameters"):
36        super().__init__(msg)

Raised when required inputs are missing or invalid.

This exception is raised when:

  • Required function arguments are not provided
  • Input arrays have incompatible shapes
  • Parameter values are outside acceptable ranges
  • Input data types are incorrect

Parameters

msg : str, optional Human-readable error message describing the input problem.

InputError(msg='Invalid or missing input parameters')
35    def __init__(self, msg="Invalid or missing input parameters"):
36        super().__init__(msg)