Skip to content

Commit

Permalink
Flask style exception handling: catch all and print.
Browse files Browse the repository at this point in the history
  • Loading branch information
GendoIkari committed Feb 6, 2017
1 parent 1caf5df commit 8232aae
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pymicro/protocols/rabbitmq.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pika
import uuid
import traceback
from pymicro.message import Message

class RabbitMQ:
Expand Down Expand Up @@ -57,7 +58,14 @@ def process_response(self, payload, channel, method, properties, body):
)

def run(self):
self.mq_channel.start_consuming()
while 1:
try:
self.mq_channel.start_consuming()
except Exception as err:
if isinstance(err, KeyboardInterrupt):
raise
traceback.print_exc()


def close(self):
self.mq_connection.close()

0 comments on commit 8232aae

Please sign in to comment.