Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
rename ErrorMalformedJSON to ErrMalformedJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Winnicki committed Aug 11, 2017
1 parent 3873b4e commit f6abed4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions functions/httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (h HTTPAPI) registerFunction(w http.ResponseWriter, r *http.Request, params
err := dec.Decode(fn)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
encoder.Encode(httpapi.NewErrorMalformedJSON(err))
encoder.Encode(httpapi.NewErrMalformedJSON(err))
return
}

Expand Down Expand Up @@ -96,7 +96,7 @@ func (h HTTPAPI) updateFunction(w http.ResponseWriter, r *http.Request, params h
err := dec.Decode(fn)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
encoder.Encode(httpapi.NewErrorMalformedJSON(err))
encoder.Encode(httpapi.NewErrMalformedJSON(err))
return
}

Expand Down
10 changes: 5 additions & 5 deletions internal/httpapi/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ type Error struct {
Error string `json:"error"`
}

// ErrorMalformedJSON occuring when it's impossible to decode JSON payload.
type ErrorMalformedJSON Error
// ErrMalformedJSON occuring when it's impossible to decode JSON payload.
type ErrMalformedJSON Error

// NewErrorMalformedJSON creates ErrorMalformedJSON.
func NewErrorMalformedJSON(err error) *ErrorMalformedJSON {
return &ErrorMalformedJSON{fmt.Sprintf("Malformed JSON payload: %s.", err.Error())}
// NewErrMalformedJSON creates ErrMalformedJSON.
func NewErrMalformedJSON(err error) *ErrMalformedJSON {
return &ErrMalformedJSON{fmt.Sprintf("Malformed JSON payload: %s.", err.Error())}
}
2 changes: 1 addition & 1 deletion pubsub/httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (h HTTPAPI) createSubscription(w http.ResponseWriter, r *http.Request, para
err := dec.Decode(s)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
encoder.Encode(httpapi.NewErrorMalformedJSON(err))
encoder.Encode(httpapi.NewErrMalformedJSON(err))
return
}

Expand Down

0 comments on commit f6abed4

Please # to comment.