Use parser result in builder error, as it might not always be a parser error

This commit is contained in:
Florian Schroedl
2022-10-17 15:22:15 +02:00
parent 2727cf1821
commit fe2b7d065d
2 changed files with 9 additions and 5 deletions

View File

@@ -79,7 +79,7 @@ let buildListItem = proc(builder: OrgBuilder): OrgBuilderResult {.closure.} =
)))
else: OrgBuilderResult.err(OrgBuilderError(
kind: parserError,
parser: listContent.error,
parser: listContent,
tree: tree,
))
@@ -106,7 +106,11 @@ proc buildParagraph*(
if not found:
builderAcc = OrgBuilderResult.err(OrgBuilderError(
kind: parserError,
kind: builderError,
parser: builderAcc.fold(
(err: OrgBuilderError) => err.parser,
(builder: OrgBuilder) => ParserResult.ok(builder.parser),
),
tree: builder.tree,
))
break