Source code for irfpy.util.exception

''' Handling irfpy exception and error.

It is recommended to define an exception calss
for ``irfpy`` project.
Here is the one. :class:`PyanaError` will provide
easy-to-use error handling class.

>>> try:
...     raise IrfpyError('This is a error')
... except IrfpyError as e:
...     print('Exception handled: {}'.format(e))
Exception handled: 'This is a error'

.. autosummary::

    IrfpyException
    IrfpyError
'''


[docs]class IrfpyException(Exception): ''' Base class for exception of Irfpy. The exception can be raised whenever error has happened. Developers may extend this exception class. ''' def __init__(self, value): self.value = value def __str__(self): return repr(self.value)
[docs]class IrfpyError(Exception): ''' Base class for error of Irfpy. The error can be raised whenever error has happened. Developers may extend this error class. ''' def __init__(self, value): self.value = value def __str__(self): return repr(self.value)
PyanaException = IrfpyException '''Alias of IrfpyException. Do not use this for new implementation''' PyanaError = IrfpyError '''Alias of IrfpyError. Do not use this for new implementation'''