Skip to content

Commit

Permalink
Merge pull request #110 from monzo/mattrco/error-fmt
Browse files Browse the repository at this point in the history
Fix string format - exceptions were not being logged
  • Loading branch information
mattrco authored Aug 20, 2019
2 parents 53e29d3 + b6df8fe commit 6d0decb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions response/slack/models/comms_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

class CommsChannelManager(models.Manager):
def create_comms_channel(self, incident):
"Creates a comms channel in slack, and saves a reference to it in the DB"
"""
Creates a comms channel in slack, and saves a reference to it in the DB
"""
try:
name = f"inc-{100+incident.pk}"
channel_id = settings.SLACK_CLIENT.get_or_create_channel(name, auto_unarchive=True)
except SlackError as e:
logger.error('Failed to create comms channel {e}')
logger.error(f"Failed to create comms channel {e}")

try:
doc_url = urljoin(
Expand All @@ -28,7 +30,7 @@ def create_comms_channel(self, incident):

settings.SLACK_CLIENT.set_channel_topic(channel_id, f"{incident.report} - {doc_url}")
except SlackError as e:
logger.error('Failed to set channel topic {e}')
logger.error(f"Failed to set channel topic {e}")

comms_channel = self.create(
incident=incident,
Expand Down

0 comments on commit 6d0decb

Please sign in to comment.