commands: Improve error messages in convert

See #2440
This commit is contained in:
Bjørn Erik Pedersen 2016-09-13 19:11:36 +02:00
parent a04abf0dda
commit 8d040c966f

View file

@ -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")