From ecaa10335490686bb770ac78b83dee2dedf659d8 Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Sun, 7 Mar 2021 16:54:41 +0100 Subject: [PATCH] Try failing gracefully on subnode read errors. --- app/db.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/db.py b/app/db.py index 00deafae6..cfbaeeeff 100644 --- a/app/db.py +++ b/app/db.py @@ -263,7 +263,7 @@ class Node: # I tried parsing the marko tree but honestly this seemed easier/simpler. html = render.markdown(subnode.content) except AssertionError: - breakpoint() + pass try: tree = lxml.html.fromstring(html) except lxml.etree.ParserError: @@ -363,7 +363,10 @@ class Subnode: # ugly, this should be in render content = render.preprocess(self.content) if self.uri.endswith('md') or self.uri.endswith('MD'): - content = render.markdown(content) + try: + content = render.markdown(content) + except: + content = "There was an error loading this subnode. You can try refreshing, which may retry this operation." if self.uri.endswith('org') or self.uri.endswith('ORG'): content = render.orgmode(content) # ugly, this too