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 <dave@quobix.com>
This commit is contained in:
quobix
2023-09-14 06:57:59 -04:00
parent 43bf162e0c
commit eb4b6e93dd

View File

@@ -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!