summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2008-06-24 11:57:32 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2008-06-24 11:57:32 +0000
commitc53a8cacf340c4f54dc16eb7107da9ddbbcbbeec (patch)
treeea5077313696ef43e66ac979ba8e7a39d3670ff3
parent764c88cfa39faa0f67d0685db7043b0610354761 (diff)
downloadpyserial-git-c53a8cacf340c4f54dc16eb7107da9ddbbcbbeec.tar.gz
- small fixed to comply to the pyserial API
- implementation passed all unit tests
-rw-r--r--pyserial/serial/serialcli.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pyserial/serial/serialcli.py b/pyserial/serial/serialcli.py
index f31062a..9864848 100644
--- a/pyserial/serial/serialcli.py
+++ b/pyserial/serial/serialcli.py
@@ -69,7 +69,11 @@ class Serial(SerialBase):
# Setup the connection info.
- self._port_handle.BaudRate = self._baudrate
+ try:
+ self._port_handle.BaudRate = self._baudrate
+ except IOError, e:
+ # catch errors from illegal baudrate settings
+ raise ValueError(str(e))
if self._bytesize == FIVEBITS:
self._port_handle.DataBits = 5
@@ -127,7 +131,10 @@ class Serial(SerialBase):
self._isOpen = False
def makeDeviceName(self, port):
- return device(port)
+ try:
+ return device(port)
+ except TypeError, e:
+ raise SerialException(str(e))
# - - - - - - - - - - - - - - - - - - - - - - - -