summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2015-12-25 16:28:23 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2015-12-25 16:28:23 +0100
commit669f30f4b1035a8eb0a5350246a3bc50cf8b376d (patch)
treea41b7cdc8498b995cd00ee67239780c551e49262 /decoders
parent2f37032807e19bc93b7f3223e1568db46318790c (diff)
downloadlibsigrokdecode-669f30f4b1035a8eb0a5350246a3bc50cf8b376d.tar.gz
libsigrokdecode-669f30f4b1035a8eb0a5350246a3bc50cf8b376d.zip
usb_power_delivery: Raise SamplerateError instead of Exception.
(for consistency with the other PDs)
Diffstat (limited to 'decoders')
-rw-r--r--decoders/usb_power_delivery/pd.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/decoders/usb_power_delivery/pd.py b/decoders/usb_power_delivery/pd.py
index da73661..ad28d97 100644
--- a/decoders/usb_power_delivery/pd.py
+++ b/decoders/usb_power_delivery/pd.py
@@ -178,6 +178,9 @@ VDM_CMDS = {
}
VDM_ACK = ['REQ', 'ACK', 'NAK', 'BSY']
+class SamplerateError(Exception):
+ pass
+
class Decoder(srd.Decoder):
api_version = 2
id = 'usb_power_delivery'
@@ -469,7 +472,7 @@ class Decoder(srd.Decoder):
def us2samples(self, us):
if not self.samplerate:
- raise Exception('Need the samplerate.')
+ raise SamplerateError('Need the samplerate.')
return int(us * self.samplerate / 1000000)
def decode_packet(self):
@@ -528,7 +531,7 @@ class Decoder(srd.Decoder):
def decode(self, ss, es, data):
if not self.samplerate:
- raise Exception('Cannot decode without samplerate.')
+ raise SamplerateError('Cannot decode without samplerate.')
for (self.samplenum, pins) in data:
# find edges ...
if self.oldpins == pins: