Save exception message when Notification breaks#13
Conversation
6f2d9f6 to
466619f
Compare
nicolasgrasset
left a comment
There was a problem hiding this comment.
Thanks @pbaranay, happy to discuss my comments more
|
|
||
| status = models.IntegerField(default=Status.CREATED) | ||
|
|
||
| exception = models.TextField(blank=True, default='') |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
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!