Skip to content

Commit

Permalink
Merge pull request #27 from timperrett/master
Browse files Browse the repository at this point in the history
Handle the error cases better for blueprints
  • Loading branch information
timperrett authored Feb 13, 2019
2 parents f852d1f + 08481fe commit 842ef61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/github.com/getnelson/nelson/blueprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func CreateBlueprint(req CreateBlueprintRequest, http *gorequest.SuperAgent, cfg
}

if r.StatusCode/100 != 2 {
errs = append(errs, errors.New(string(body[:])))
errs = append(errs, errors.New("Unexpectedly recieved a "+strconv.Itoa(r.StatusCode)+" reponse from the server."))
return result, errs
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/github.com/getnelson/nelson/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ func main() {
r, e := CreateBlueprint(wire, http, cfg)
pi.Stop()
if e != nil {
PrintTerminalErrors(e)
return cli.NewExitError("Unable to create blueprint.", 1)
} else {
fmt.Println("Successfully created blueprint " + r.Name + "@" + r.Revision + ".")
Expand Down Expand Up @@ -252,6 +253,7 @@ func main() {
r, e := InspectBlueprint(bpName, http, cfg)
pi.Stop()
if e != nil {
PrintTerminalErrors(e)
return cli.NewExitError("Unable to create blueprint.", 1)
} else {
fmt.Println(r.Template)
Expand Down

0 comments on commit 842ef61

Please sign in to comment.