Skip to content
Browse files

more try/except around callbacks + TODO reviewed

  • Loading branch information...
1 parent 626274f commit b1fcf635f1414120155989d09ff354537270320e @paolo-losi committed
Showing with 22 additions and 3 deletions.
  1. +6 −0 TODO
  2. +4 −1 stormed/connection.py
  3. +7 −1 stormed/method/channel.py
  4. +5 −1 stormed/method/connection.py
View
6 TODO
@@ -1,4 +1,10 @@
* review of all methods
+ - flow control
+ - queue.bind and queue.purge
+ - refactor queue_declare callback
+ - basic.return
+ - basic.recover?
+ - tx.select, tx.commit, tx.rollback
* check conn/channel status before sending frames
* logging
* handling of callback failures
View
5 stormed/connection.py
@@ -117,7 +117,10 @@ def close_stream(self):
def on_closed_stream(self):
if self.status != status.CLOSED:
if self.on_disconnect:
- self.on_disconnect()
+ try:
+ self.on_disconnect()
+ except Exception:
+ logger.error('ERROR in on_error() callback', exc_info=True)
def reset(self):
for c in self.channels:
View
8 stormed/method/channel.py
@@ -31,4 +31,10 @@ def handle(self, channel):
channel.reset()
error_code = id2constant.get(self.reply_code, '')
if channel.on_error:
- channel.on_error(ChannelError(error_code, self.reply_text, method))
+ try:
+ channel.on_error(ChannelError(error_code, self.reply_text, method))
+ except Exception:
+ logger.error('ERROR in on_error() callback for channel %d',
+ channel.channel_id, exc_info=True)
+
+# TODO flow control
View
6 stormed/method/connection.py
@@ -65,4 +65,8 @@ def handle(self, conn):
conn.reset()
error_code = id2constant.get(self.reply_code, '')
if conn.on_error:
- conn.on_error(ConnectionError(error_code, self.reply_text, method))
+ try:
+ conn.on_error(ConnectionError(error_code, self.reply_text, method))
+ except Exception:
+ logger.error('ERROR in on_error() callback', exc_info=True)
+

0 comments on commit b1fcf63

Please sign in to comment.
Something went wrong with that request. Please try again.