diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2008-06-24 11:57:32 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2008-06-24 11:57:32 +0000 |
commit | 9afe9b6d1b6b824bb02819547204c3b04bbc58e7 (patch) | |
tree | 7e6d57c7153598dcd3c17f831f8aeb7b85506882 | |
parent | af6027d7ced13d8e15378a5e3ca95f9a0155bfab (diff) | |
download | pyserial-9afe9b6d1b6b824bb02819547204c3b04bbc58e7.tar.gz |
- small fixed to comply to the pyserial API
- implementation passed all unit tests
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@189 f19166aa-fa4f-0410-85c2-fa1106f25c8a
-rw-r--r-- | serial/serialcli.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/serial/serialcli.py b/serial/serialcli.py index f31062a..9864848 100644 --- a/serial/serialcli.py +++ b/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)) # - - - - - - - - - - - - - - - - - - - - - - - - |