Skip to content

Conversation

pbaranay
Copy link

It would be very useful to see the text of the exception that's thrown when sending a notification breaks. Here's a pull request to add a field storing this information to the model. Please let me know what you think!

@coveralls
Copy link

coveralls commented Sep 26, 2017

Coverage Status

Coverage increased (+0.4%) to 79.251% when pulling 466619f on exception-logging into b50aed0 on master.

@makingspace makingspace deleted a comment from coveralls Sep 26, 2017
Copy link
Contributor

@nicolasgrasset nicolasgrasset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pbaranay, happy to discuss my comments more


status = models.IntegerField(default=Status.CREATED)

exception = models.TextField(blank=True, default='')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pbaranay! Unfortunately, the Notification model is meant to be extremely lean since it's storing 100s of millions of entries in production.

I'd suggest moving this feature to separate table since most notifications shouldn't have any exception anyway!

except:
except Exception as e:
self.status = self.Status.BROKEN
self.exception = "{klass}: {message}".format(klass=e.__class__.__name__, message=str(e))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably, this could be done through a logging system rather than a permanent data store. I think logging would be a more suitable solution to introduce here since it's only assuming you've configured Django for it right now.

Either way you will want to make it configurable with settings. Logging is controlled by logging routes in settings, but if you introduce a new model/field, please add a setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants