Skip to content

Commit f3db860

Browse files
committed
better error handling
1 parent 5e1f281 commit f3db860

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/macro_storage_format_parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def _split_macro_body_on_content_block(self, macro_body: str) -> tuple[str, str]
1818
if "[content]" in macro_body:
1919
splitted = re.split(r'\[content\]\s*(\r\n|\r|\n\r|\n)', macro_body, maxsplit=1)
2020
# re.split splits also the capturing group \n as [1]!
21-
return (splitted[0], splitted[2])
21+
if len(splitted) > 2:
22+
return (splitted[0], splitted[2])
2223
return ("ERROR SPLITTING AT [CONTENT]", "ERROR: INVALID NEWLINE")
2324

2425
def transform(self):

0 commit comments

Comments
 (0)