From eb4b6e93dd22810e49229486547fa94150e073a1 Mon Sep 17 00:00:00 2001 From: quobix Date: Thu, 14 Sep 2023 06:57:59 -0400 Subject: [PATCH] Tuned logic on render only code for document. I could not build a test to ensure any error returned from creating a new doc after rendering was caught. There is no way to test the code, so I changed the logic to capture all errors and cascade down. Same outcome, simplified flow. Signed-off-by: quobix --- document.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/document.go b/document.go index d99e6ab..b939998 100644 --- a/document.go +++ b/document.go @@ -189,13 +189,15 @@ func (d *document) RenderAndReload() ([]byte, Document, *DocumentModel[v3high.Do return nil, nil, nil, []error{rerr} } + var errs []error + newDoc, err := NewDocumentWithConfiguration(newBytes, d.config) if err != nil { - return newBytes, newDoc, nil, []error{err} + errs = append(errs, err) } // build the model. - model, errs := newDoc.BuildV3Model() - if errs != nil { + model, buildErrs := newDoc.BuildV3Model() + if buildErrs != nil { return newBytes, newDoc, model, errs } // this document is now dead, long live the new document!