-
Notifications
You must be signed in to change notification settings - Fork 33
Conversation
rmulhol
commented
Jun 27, 2019
- Emit specific errors with custom errors when execution fails
- Put tmp directories inside vdb directory (so we don't need permissions outside of it for execution)
- Call goose via library rather than binary (so we don't need the binary in the execution environment)
cmd/root.go
Outdated
fmt.Println("Error: ", invalidConfigError) | ||
log.Fatal(invalidConfigError) | ||
formattedError := fmt.Sprintf("%s: %s", invalidConfigError, err.Error()) | ||
log.Fatal(formattedError) | ||
os.Exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal, but log.Fatal calls os.Exit(1) so you can lose this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just rebase on your PR :D
- include actual error to highlight the specific issue
- include specific error
- enable separator between home and migrations dir
- Removes dependency on goose binary existing in plugin execution environment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Errorf
fyi, saves you a trip to the Sprintf
:)
@rmulhol Late to the party, but great fixes! Especially nice with more expressive error messages 🙏 |