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)
|
req, err := decodePostThingRequest(ctx, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errors.EncodeHTTP(ctx, err, w)
|
EncodeError(ctx, err, w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do stuff here
|
// Do stuff here
|
||||||
if err := h.ThingService.CreateThing(ctx, req.Thing); err != nil {
|
if err := h.ThingService.CreateThing(ctx, req.Thing); err != nil {
|
||||||
errors.EncodeHTTP(ctx, err, w)
|
EncodeError(ctx, err, w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue