chore(http): update error handling example in readme (#13874)
parent
184ed7120e
commit
29d2387752
|
@ -69,13 +69,13 @@ func (h *ThingHandler) handlePostThing(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
req, err := decodePostThingRequest(ctx, r)
|
||||
if err != nil {
|
||||
errors.EncodeHTTP(ctx, err, w)
|
||||
EncodeError(ctx, err, w)
|
||||
return
|
||||
}
|
||||
|
||||
// Do stuff here
|
||||
if err := h.ThingService.CreateThing(ctx, req.Thing); err != nil {
|
||||
errors.EncodeHTTP(ctx, err, w)
|
||||
EncodeError(ctx, err, w)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue