Skip to content

Commit

Permalink
Print proper error if trigger doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
retgits committed Jun 1, 2018
1 parent a427716 commit fb29124
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,11 @@ func doPrepare(env env.Project, options *PrepareOptions) (err error) {

fmt.Println("Shim:", options.Shim)

for _, value := range descriptor.Triggers {
found := false

fmt.Println("Id:", value.Id)
for _, value := range descriptor.Triggers {
if value.Id == options.Shim {
found = true
triggerPath := filepath.Join(env.GetVendorSrcDir(), value.Ref, "trigger.json")

mdJson, err := fgutil.LoadLocalFile(triggerPath)
Expand Down Expand Up @@ -291,6 +292,12 @@ func doPrepare(env env.Project, options *PrepareOptions) (err error) {
}
}

if !found {
fmt.Printf("\nCan't locate trigger with id [%s] in flogo.json\n", options.Shim)
fmt.Printf("Please check if you have specified the correct trigger id\n\n")
os.Exit(2)
}

} else if options.EmbedConfig {
createEmbeddedAppGoFile(env.GetAppDir(), appJson)
}
Expand Down

0 comments on commit fb29124

Please sign in to comment.