================
API - Exceptions
================

.. module:: lannerpsp.exc

.. currentmodule:: lannerpsp

The following exceptions are defined by Lanner PSP. Please note that multiple
inheritance is heavily used in the exception hierarchy to make testing for
exceptions easier. For example, to capture any exception generated by Lanner
PSP's code::

    from lannerpsp import *

    led = LTEStressLED()
    try:
        led.set_strength(200)
    except PSPError:
        print("A Lanner PSP error occurred")

Since all Lanner PSP's exceptions descend from :exc:`PSPError`, this will
work. However, certain specific errors have multiple parents. For example, in
the case that an out of range value is passed to :attr:`percent` you
would expect a :exc:`ValueError` to be raised. In fact, a
:exc:`PSPInvalid` error will be raised. However, note that this
descends from both :exc:`PSPError` (indirectly) and from :exc:`ValueError`
so you can still do the obvious::

    from lannerpsp import *

    led = LTEStressLED()
    try:
        led.set_strength(200)
    except ValueError:
        print("Bad value specified")

Errors
======

.. autoexception:: PSPError
    :show-inheritance:

.. autoexception:: PSPNotExist
    :show-inheritance:

.. autoexception:: PSPNotOpened
    :show-inheritance:

.. autoexception:: PSPInvalid
    :show-inheritance:

.. autoexception:: PSPNotSupport
    :show-inheritance:

.. autoexception:: PSPBusyInUses
    :show-inheritance:

.. autoexception:: PSPBoardNotMatch
    :show-inheritance:

.. autoexception:: PSPDriverNotLoad
    :show-inheritance:

.. autoexception:: IPMIError
    :show-inheritance:

.. autoexception:: IPMIIdleState
    :show-inheritance:

.. autoexception:: IPMIWriteState
    :show-inheritance:

.. autoexception:: IPMIReadState
    :show-inheritance:

.. autoexception:: IPMIIBF0
    :show-inheritance:

.. autoexception:: IPMIOBF1
    :show-inheritance:

Warnings
========

.. autoexception:: PSPWarning
    :show-inheritance:
