From: Bjørn Erik Pedersen Date: Tue, 13 Sep 2016 17:11:36 +0000 (+0200) Subject: commands: Improve error messages in convert X-Git-Tag: v0.17~70 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8d040c96;p=brevno-suite%2Fhugo commands: Improve error messages in convert See #2440 --- diff --git a/commands/convert.go b/commands/convert.go index b9aa7b8f..da821781 100644 --- a/commands/convert.go +++ b/commands/convert.go @@ -137,17 +137,17 @@ func convertContents(mark rune) (err error) { page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), file.Dir())) page.SetSourceContent(psr.Content()) if err = page.SetSourceMetaData(metadata, mark); err != nil { - return err + return fmt.Errorf("Failed to set source metadata for file %q: %s", page.FullFilePath(), err) } if outputDir != "" { if err = page.SaveSourceAs(filepath.Join(outputDir, page.FullFilePath())); err != nil { - return err + return fmt.Errorf("Failed to save file %q: %s", page.FullFilePath(), err) } } else { if unsafe { if err = page.SaveSource(); err != nil { - return err + return fmt.Errorf("Failed to save file %q: %s", page.FullFilePath(), err) } } else { jww.FEEDBACK.Println("Unsafe operation not allowed, use --unsafe or set a different output path")