Skip to content

Commit 4b4c5b9

Browse files
committed
fix small bug when sending error message in slack before project could be initilaized
1 parent 953a478 commit 4b4c5b9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mapswipe_workers/mapswipe_workers/mapswipe_workers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,15 @@ def run_create_projects():
9393
except CustomError as e:
9494
ref = fb_db.reference(f"v2/projectDrafts/{project_draft_id}")
9595
ref.set({})
96+
97+
# check if project could be initialized
98+
try:
99+
project_id = project.projectId
100+
except UnboundLocalError:
101+
project_id = None
102+
96103
send_slack_message(
97-
MessageType.FAIL, project_name, project.projectId, str(e)
104+
MessageType.FAIL, project_name, project_id, str(e)
98105
)
99106
logger.exception("Failed: Project Creation ({0}))".format(project_name))
100107
sentry.capture_exception()

0 commit comments

Comments
 (0)