SF.net SVN: fclient: [448] trunk/fcp2/src/fcp2/iohandler.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-01 07:21:33
|
Revision: 448
http://fclient.svn.sourceforge.net/fclient/?rev=448&view=rev
Author: jUrner
Date: 2008-07-01 00:21:36 -0700 (Tue, 01 Jul 2008)
Log Message:
-----------
worked over exceptions
Modified Paths:
--------------
trunk/fcp2/src/fcp2/iohandler.py
Modified: trunk/fcp2/src/fcp2/iohandler.py
===================================================================
--- trunk/fcp2/src/fcp2/iohandler.py 2008-07-01 07:20:49 UTC (rev 447)
+++ trunk/fcp2/src/fcp2/iohandler.py 2008-07-01 07:21:36 UTC (rev 448)
@@ -251,7 +251,8 @@
try:
#TODO: if \r\n is possible in Fcp, replace it by \n
p = self.io.read(n)
- assert p, 'No bytes received and IO did not raise as expected?!?'
+ if not p:
+ raise RuntimeError('No bytes received and IO did not raise as expected?!?')
self._receiveBuffer += p
except consts.IOTimeoutError, details: # nothing in queue
raise consts.IOTimeoutError(details)
@@ -261,6 +262,10 @@
"""Reads the next message from io device
@return: (Message) next message from the socket
+ @raise IOBrokenError: (L{consts.IOBrokenError}) if the io breaks unexpectedly
+ @raise IOTimeoutError: (L{consts.IOTimeoutError}) if no message is in the io
+ @raise MessageParseError: (L{consts.IMessageParseError}) if the message is invalid
+
@note: if something goes wrong the according exception is raised
"""
# read message from io
@@ -294,7 +299,7 @@
msgClass = message.MessagesAll.get(msgName, None)
if msgClass is None:
consts.Logger.IOHandler.debug(consts.LogMessages.CreatingNewMessageType + ' "%s"' % msgClassname)
- msgClass = message.newMessageType(msgName)
+ msgClass = message.newMessageClass(msgName)
msg = msgClass()
# process param --> value fields
@@ -306,7 +311,7 @@
if mayHaveData:
n = msg._getDataLength()
if not isinstance(n, (int, long)):
- raise ValueError('DataLength must be type(int)')
+ raise consts.MessageParseError('DataLength must be type(int)')
if n > 0:
while self._receiveBuffer:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|