Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
better exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
inkhey committed Sep 27, 2018
1 parent 02f6de4 commit dfbbaa3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions backend/tracim_backend/lib/mail_notifier/notifier.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import datetime
import traceback
import typing

from email.mime.multipart import MIMEMultipart
Expand Down Expand Up @@ -130,7 +129,7 @@ def notify_content_update(self, content: Content):
except Exception as e:
# TODO - G.M - 2018-08-27 - Do Better catching for exception here
logger.error(self, 'Exception catched during email notification: {}'.format(e.__str__()))
logger.error(self, traceback.format_exc())
logger.exception(self, e)


class EmailManager(object):
Expand Down
5 changes: 5 additions & 0 deletions backend/tracim_backend/lib/utils/logger.py
Expand Up @@ -43,5 +43,10 @@ def warning(self, instance_or_class, message):
Logger.TPL.format(cls=self._txt(instance_or_class), msg=message)
)

def exception(self, instance_or_class, message):
self._logger.exception(
Logger.TPL.format(cls=self._txt(instance_or_class), msg=message)
)


logger = Logger('tracim')

0 comments on commit dfbbaa3

Please sign in to comment.