From 05587922828f97b01b9cbe5b3bb4aa416baaeab5 Mon Sep 17 00:00:00 2001 From: Rob Mulholand Date: Thu, 27 Jun 2019 09:52:29 -0500 Subject: [PATCH] Log error on failure to setup plugin migrations - include specific error --- pkg/plugin/manager/manager.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/plugin/manager/manager.go b/pkg/plugin/manager/manager.go index 74e9c182..3f9dce28 100644 --- a/pkg/plugin/manager/manager.go +++ b/pkg/plugin/manager/manager.go @@ -77,13 +77,15 @@ func (m *manager) setupMigrationEnv() error { if err != nil { return err } - err = os.RemoveAll(m.tmpMigDir) - if err != nil { - return errors.New(fmt.Sprintf("unable to remove file found at %s where tmp directory needs to be written", m.tmpMigDir)) + removeErr := os.RemoveAll(m.tmpMigDir) + if removeErr != nil { + removeErrString := "unable to remove file found at %s where tmp directory needs to be written: %s" + return errors.New(fmt.Sprintf(removeErrString, m.tmpMigDir, removeErr.Error())) } - err = os.Mkdir(m.tmpMigDir, os.FileMode(os.ModePerm)) - if err != nil { - return errors.New(fmt.Sprintf("unable to create temporary migration directory %s", m.tmpMigDir)) + mkdirErr := os.Mkdir(m.tmpMigDir, os.FileMode(os.ModePerm)) + if mkdirErr != nil { + mkdirErrString := "unable to create temporary migration directory %s: %s" + return errors.New(fmt.Sprintf(mkdirErrString, m.tmpMigDir, mkdirErr.Error())) } return nil