From 35f1ed21c3ba5ddb06dde911fab6d4ff3f85f048 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Fri, 18 Dec 2020 16:25:44 -0500 Subject: [PATCH] More logging around markdown stash failures --- ui/ui.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/ui.go b/ui/ui.go index 3f1417b..e167a2c 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -655,7 +655,7 @@ func stashDocument(cc *charm.Client, md markdown) tea.Cmd { } // Is the document missing a body? If so, it likely means it needs to - // be loaded. But...if it turnsout the document body really is empty + // be loaded. But...if it turns out the document body really is empty // then we'll stash it anyway. if len(md.Body) == 0 { switch md.docType { @@ -673,6 +673,9 @@ func stashDocument(cc *charm.Client, md markdown) tea.Cmd { case NewsDoc: newMD, err := fetchMarkdown(cc, md.ID, md.docType) if err != nil { + if debug { + log.Println(err) + } return stashFailMsg{err, md} } md.Body = newMD.Body @@ -686,8 +689,6 @@ func stashDocument(cc *charm.Client, md markdown) tea.Cmd { } } - md.convertToStashed() - newMd, err := cc.StashMarkdown(md.Note, md.Body) if err != nil { if debug { @@ -696,6 +697,8 @@ func stashDocument(cc *charm.Client, md markdown) tea.Cmd { return stashFailMsg{err, md} } + md.convertToStashed() + // The server sends the whole stashed document back, but we really just // need to know the ID so we can operate on this newly stashed // markdown.