Skip to content

Commit 24f44d8

Browse files
committed
Consistent errors on transmission failure for usb2can. hardbyte#77
1 parent a2f8dd6 commit 24f44d8

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

can/interfaces/usb2can.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This wrapper is for windows or direct access via CANAL API. Socket CAN is recommended under Unix/Linux systems
2-
2+
import can
33
from ctypes import *
44
from struct import *
55
import logging
@@ -81,7 +81,7 @@ def CanalSend(self, handle, msg):
8181
return res
8282
except:
8383
logging.warning('Sending error')
84-
raise
84+
raise can.CanError("Failed to transmit frame")
8585

8686
def CanalReceive(self, handle, msg):
8787
try:

can/interfaces/usb2canInterface.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def __init__(self, channel, *args, **kwargs):
110110
self.handle = self.can.CanalOpen(connector, enable_flags)
111111

112112
def send(self, msg):
113-
114113
tx = message_convert_tx(msg)
115114
self.can.CanalSend(self.handle, byref(tx))
116115

0 commit comments

Comments
 (0)