From ffd82c2d765d89ac8a9846709e583418757d13eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Thu, 10 Dec 2020 00:15:30 +0100 Subject: [PATCH] Show specific error on property line found before :PROPERTIES: one. --- org_dom/org_dom.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/org_dom/org_dom.py b/org_dom/org_dom.py index bd9bec8..2ea484a 100644 --- a/org_dom/org_dom.py +++ b/org_dom/org_dom.py @@ -1029,7 +1029,15 @@ class OrgDomReader: elif as_time := parse_org_time(value): value = as_time - self.current_drawer.append(Property(linenum, match, key, value, None)) + try: + self.current_drawer.append(Property(linenum, match, key, value, None)) + except: + if "current_drawer" not in dir(self): # Throw a better error on this case + raise Exception( + "Found properties before :PROPERTIES: line. Error on Org file?" + ) + else: + raise # Let the exception pass def read(self, s, environment): lines = s.split("\n")