Skip to content
This repository was archived by the owner on Jan 16, 2021. It is now read-only.

Commit b0bc76b

Browse files
committed
[hooks] provide helpful message for incorrect op
* provide helpful message for incorrect op case * fix breaking test
1 parent 1d67e22 commit b0bc76b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

webhooks/hooks.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ func (h *Hooks) appendHookOperation(
115115

116116
method := strings.ToUpper(hookOp.Method)
117117
if method != "POST" && method != "PUT" && method != "DELETE" {
118+
op, err := json.MarshalIndent(hookOp, "", " ")
119+
if err == nil {
120+
fmt.Fprintf(e.Out, "Please fix the incorrect operation in:\n%s\n", op)
121+
}
118122
return false, nil, stackerr.Wrap(errInvalidFormat)
119123
}
120124

webhooks/triggers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func newTriggersHarness(t testing.TB) *parsecli.Harness {
4949
}
5050
} else {
5151
return &http.Response{StatusCode: http.StatusBadRequest},
52-
errors.New("no such trigger is defined")
52+
errors.New("no such trigger is defined for class")
5353
}
5454
case "POST":
5555
ensure.DeepEqual(t, r.URL.Path, defaultTriggersURL)

0 commit comments

Comments
 (0)