add exception handler

This commit is contained in:
2020-10-27 12:59:19 +00:00
parent 32fe76f8ae
commit fd8df68deb
2 changed files with 16 additions and 3 deletions

View File

@@ -102,7 +102,12 @@ class Post(models.Model):
if not self.agenda_key: if not self.agenda_key:
return None return None
try:
html = getPadHTML(self.agenda_key) html = getPadHTML(self.agenda_key)
except Exception as e:
logger.error("Can't get the agenda html from agenda key '{}'. Error: {}".format(self.agenda_key, e))
html = None
return html return html
@agenda_html.setter @agenda_html.setter

View File

@@ -74,10 +74,18 @@ def show(request, id=None):
ep_protocol_link = "#" ep_protocol_link = "#"
if p.has_agenda and p.agenda_key: if p.has_agenda and p.agenda_key:
try:
ep_agenda_link = get_pad_link(p.agenda_key) ep_agenda_link = get_pad_link(p.agenda_key)
except Exception as e:
logger.error("Can't get the agenda link from '{}'. Error: {}".format(p.agenda_key, e))
ep_agenda_link = "#"
if p.has_protocol and p.protocol_key: if p.has_protocol and p.protocol_key:
try:
ep_protocol_link = get_pad_link(p.protocol_key) ep_protocol_link = get_pad_link(p.protocol_key)
except Exception as e:
logger.error("Can't get the protocol link from '{}'. Error: {}".format(p.protocol_key, e))
ep_protocol_link = "#"
context = { context = {
"post": p, "post": p,