-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy patherrors.py
executable file
·150 lines (111 loc) · 4.42 KB
/
errors.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
__all__ = [
'IsoTpError',
'BlockingSendFailure',
'BadGeneratorError',
'BlockingSendTimeout',
'FlowControlTimeoutError',
'ConsecutiveFrameTimeoutError',
'InvalidCanDataError',
'UnexpectedFlowControlError',
'UnexpectedConsecutiveFrameError',
'ReceptionInterruptedWithSingleFrameError',
'ReceptionInterruptedWithFirstFrameError',
'WrongSequenceNumberError',
'UnsupportedWaitFrameError',
'MaximumWaitFrameReachedError',
'FrameTooLongError',
'ChangingInvalidRXDLError',
'MissingEscapeSequenceError',
'InvalidCanFdFirstFrameRXDL',
'OverflowError'
]
from typing import Any
class IsoTpError(Exception):
def __init__(self, *args: Any, **kwargs: Any) -> None:
Exception.__init__(self, *args, **kwargs)
class BlockingSendFailure(IsoTpError):
"""Happens when a blocking send fails to complete"""
pass
class BadGeneratorError(IsoTpError):
"""Happens when the user tries to send data using a generator and provides a size that does not match the amount of data in the generator"""
pass
class BlockingSendTimeout(BlockingSendFailure):
"""Happens when a blocking send fails to complete because the user timeout is expired. Inherits :class:`BlockingSendFailure<isotp.BlockingSendFailure>`"""
pass
class FlowControlTimeoutError(IsoTpError):
"""
Happens when the senders fails to sends a Flow Control message in time.
Refer to TransportLayer parameter :ref:`rx_flowcontrol_timeout<param_rx_flowcontrol_timeout>`
"""
pass
class ConsecutiveFrameTimeoutError(IsoTpError):
"""
Happens when the senders fails to sends a Consecutive Frame message in time.
Refer to TransportLayer parameter :ref:`rx_consecutive_frame_timeout<param_rx_consecutive_frame_timeout>`
"""
pass
class InvalidCanDataError(IsoTpError):
"""
Happens when a CAN message that cannot be decoded as valid First Frame, Consecutive Frame, Single Frame or Flow Control PDU is received.
"""
pass
class UnexpectedFlowControlError(IsoTpError):
"""
Happens when a Flow Control message is received and was not expected
"""
pass
class UnexpectedConsecutiveFrameError(IsoTpError):
"""
Happens when a Consecutive Frame message is received and was not expected
"""
pass
class ReceptionInterruptedWithSingleFrameError(IsoTpError):
"""
Happens when the reception of a multi packet message reception is interrupted with a new Single Frame PDU.
"""
pass
class ReceptionInterruptedWithFirstFrameError(IsoTpError):
"""
Happens when the reception of a multi packet message reception is interrupted with a new First Frame PDU.
"""
pass
class WrongSequenceNumberError(IsoTpError):
"""
Happens when a consecutive frame is received with a wrong sequence number.
"""
pass
class UnsupportedWaitFrameError(IsoTpError):
"""
Happens when a Flow Control PDU with FlowStatus=Wait is received and :ref:`wftmax<param_wftmax>` is set to 0
"""
pass
class MaximumWaitFrameReachedError(IsoTpError):
"""
Happens when too much Flow Control PDU with FlowStatus=Wait is received. Refer to :ref:`wftmax<param_wftmax>`
"""
pass
class FrameTooLongError(IsoTpError):
"""
Happens when a FirstFrame with a length (FF_DL) longer than :ref:`max_frame_size<param_max_frame_size>` is received.
"""
pass
class ChangingInvalidRXDLError(IsoTpError):
"""
Happens when a ConsecutiveFrame is received with a length smaller than ``RX_DL`` (size of first frame) without being the last message of the IsoTP frame.
"""
pass
class MissingEscapeSequenceError(IsoTpError):
"""
Happens when a SingleFrame with length (CAN_DL) greater than 8 bytes is received and the length of the payload (SF_DL) is encoded in the first byte, which is forbidden by ISO-15765-2
"""
pass
class InvalidCanFdFirstFrameRXDL(IsoTpError):
"""
Happens when a FirstFrame is received with missing data; In other words when CAN_DL is smaller than the deduced RX_DL. The sender did not optimized the capacity usage of the CAN message.
"""
pass
class OverflowError(IsoTpError):
"""
Happens when the TransportLayer receive a FlowControl PDU with a FlowStatus=Overflow (2). In this event, the transmission is stopped.
"""
pass