#139 Log the reason ConnectionException
Merged 4 years ago by jskladan. Opened 4 years ago by pingou.
taskotron/ pingou/resultsdb better_debug  into  develop

file modified
+4 -3
@@ -110,10 +110,11 @@ 

              body=body

          )

          publish(msg)

+         log.debug("Message published")

      except PublishReturned as e:

          log.error('Fedora Messaging broker rejected message {}: {}'.format(msg.id, e))

      except ConnectionException as e:

-         log.error('Error sending message {}: {}'.format(msg.id, e))

+         log.error('Error sending message {}: {}'.format(msg.id, e.reason))

  

  

  def create_message(result):
@@ -161,11 +162,11 @@ 

                  body=message

              )

              publish(msg)

+             log.debug("Message published")

          except PublishReturned as e:

              log.error('Fedora Messaging broker rejected message {}: {}'.format(msg.id, e))

          except ConnectionException as e:

-             log.error('Error sending message {}: {}'.format(msg.id, e))

- 

+             log.error('Error sending message {}: {}'.format(msg.id, e.reason))

  

  

  class StompPlugin(MessagingPlugin):

ConnectionException seems to not print anything when printed as is
but it has a reason attribute which does provide more information
so print it directly.

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

1 new commit added

  • Log when a message was successfully published
4 years ago

Added a second commit so we also have a clear log entry for when messages are successfully published :)

Someone who has permission to merge should review this.

It's not clear from ConnectionException documentation that it even has reason attribute (unless you look at the source code).

Also the documentation mentions logging the exception basically with str(e) which looks like a bug in fedora-messaging.

I'm trying to fix this in fedora-messaging.

Pull-Request has been merged by jskladan

4 years ago
Metadata