summaryrefslogtreecommitdiff
path: root/decoders/can/pd.py
diff options
context:
space:
mode:
Diffstat (limited to 'decoders/can/pd.py')
-rw-r--r--decoders/can/pd.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/decoders/can/pd.py b/decoders/can/pd.py
index e425575..f80ebc6 100644
--- a/decoders/can/pd.py
+++ b/decoders/can/pd.py
@@ -20,6 +20,9 @@
import sigrokdecode as srd
+class SamplerateError(Exception):
+ pass
+
class Decoder(srd.Decoder):
api_version = 2
id = 'can'
@@ -358,8 +361,8 @@ class Decoder(srd.Decoder):
self.curbit += 1
def decode(self, ss, es, data):
- if self.samplerate is None:
- raise Exception("Cannot decode without samplerate.")
+ if not self.samplerate:
+ raise SamplerateError('Cannot decode without samplerate.')
for (self.samplenum, pins) in data:
(can_rx,) = pins