File: exceptions.py

package info (click to toggle)
python-can 4.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,372 kB
  • sloc: python: 25,840; makefile: 38; sh: 20
file content (44 lines) | stat: -rw-r--r-- 978 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
Ctypes wrapper module for IXXAT Virtual CAN Interface V4 on win32 systems

Copyright (C) 2016 Giuseppe Corbelli <giuseppe.corbelli@weightpack.com>
Copyright (C) 2019 Marcel Kanter <marcel.kanter@googlemail.com>
"""

from can import (
    CanInitializationError,
    CanOperationError,
    CanTimeoutError,
)

__all__ = [
    "VCITimeout",
    "VCIError",
    "VCIRxQueueEmptyError",
    "VCIBusOffError",
    "VCIDeviceNotFoundError",
]


class VCITimeout(CanTimeoutError):
    """Wraps the VCI_E_TIMEOUT error"""


class VCIError(CanOperationError):
    """Try to display errors that occur within the wrapped C library nicely."""


class VCIRxQueueEmptyError(VCIError):
    """Wraps the VCI_E_RXQUEUE_EMPTY error"""

    def __init__(self):
        super().__init__("Receive queue is empty")


class VCIBusOffError(VCIError):
    def __init__(self):
        super().__init__("Controller is in BUSOFF state")


class VCIDeviceNotFoundError(CanInitializationError):
    pass