commands: Report errors in convert
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 13 Sep 2016 08:49:19 +0000 (10:49 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 13 Sep 2016 08:49:51 +0000 (10:49 +0200)
Fixes #2440

commands/convert.go

index cd809d3e528a248a160a3ba7d00b3cca6b0078b5..b9aa7b8fa32f2884630f0266800e6904ed296d22 100644 (file)
@@ -136,13 +136,19 @@ func convertContents(mark rune) (err error) {
 
                page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), file.Dir()))
                page.SetSourceContent(psr.Content())
-               page.SetSourceMetaData(metadata, mark)
+               if err = page.SetSourceMetaData(metadata, mark); err != nil {
+                       return err
+               }
 
                if outputDir != "" {
-                       page.SaveSourceAs(filepath.Join(outputDir, page.FullFilePath()))
+                       if err = page.SaveSourceAs(filepath.Join(outputDir, page.FullFilePath())); err != nil {
+                               return err
+                       }
                } else {
                        if unsafe {
-                               page.SaveSource()
+                               if err = page.SaveSource(); err != nil {
+                                       return err
+                               }
                        } else {
                                jww.FEEDBACK.Println("Unsafe operation not allowed, use --unsafe or set a different output path")
                        }