refactor: surface errors when running reports
This commit is contained in:
@@ -7,14 +7,14 @@ import (
|
||||
)
|
||||
|
||||
// ReportSingleApp is an internal function that displays the app report for one or more apps
|
||||
func ReportSingleApp(appName, infoFlag string) {
|
||||
func ReportSingleApp(appName, infoFlag string) error {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
common.LogFail(err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
buildpacks, err := common.PropertyListGet("buildpacks", appName, "buildpacks")
|
||||
if err != nil {
|
||||
common.LogFail(err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
infoFlags := map[string]string{
|
||||
@@ -23,5 +23,5 @@ func ReportSingleApp(appName, infoFlag string) {
|
||||
|
||||
trimPrefix := false
|
||||
uppercaseFirstCharacter := true
|
||||
common.ReportSingleApp("buildpacks", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp("buildpacks", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func main() {
|
||||
buildpacks.TriggerPostExtract(appName, sourceWorkDir)
|
||||
case "report":
|
||||
appName := flag.Arg(0)
|
||||
buildpacks.ReportSingleApp(appName, "")
|
||||
err = buildpacks.ReportSingleApp(appName, "")
|
||||
default:
|
||||
common.LogFail(fmt.Sprintf("Invalid plugin trigger call: %s", trigger))
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ func CommandRemove(args []string, index int) (err error) {
|
||||
}
|
||||
|
||||
// CommandReport displays a buildpacks report for one or more apps
|
||||
func CommandReport(appName string, infoFlag string) {
|
||||
func CommandReport(appName string, infoFlag string) error {
|
||||
if strings.HasPrefix(appName, "--") {
|
||||
infoFlag = appName
|
||||
appName = ""
|
||||
@@ -126,15 +126,18 @@ func CommandReport(appName string, infoFlag string) {
|
||||
if len(appName) == 0 {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
return
|
||||
return err
|
||||
}
|
||||
for _, appName := range apps {
|
||||
ReportSingleApp(appName, infoFlag)
|
||||
if err := ReportSingleApp(appName, infoFlag); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
ReportSingleApp(appName, infoFlag)
|
||||
return ReportSingleApp(appName, infoFlag)
|
||||
|
||||
}
|
||||
|
||||
// CommandSet implements buildpacks:set
|
||||
|
||||
Reference in New Issue
Block a user