Re: [go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-26 Thread pierre . curto
Le jeudi 26 janvier 2017 07:42:55 UTC+1, JohnGB a écrit : > > Thanks Pierre, that looks like a simple and quite clean implementation. > Although it's easier to use an iota for the numbering, does that open up > any issues with keeping the documentation up to date? I know it's easier > to pro

Re: [go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-26 Thread Manlio Perillo
Il giorno giovedì 26 gennaio 2017 07:37:49 UTC+1, JohnGB ha scritto: > > Since it is an HTTP Api, what about returning a standard HTTP status line, >> maybe with some non standard status code) and additional details about the >> error in the response body, JSON encoded? > > > That is exactly what

Re: [go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-25 Thread Tamás Gulácsi
2017. január 26., csütörtök 7:37:49 UTC+1 időpontban JohnGB a következőt írta: > > Since it is an HTTP Api, what about returning a standard HTTP status line, >> maybe with some non standard status code) and additional details about the >> error in the response body, JSON encoded? > > > That is e

Re: [go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-25 Thread John Beckett
Thanks Pierre, that looks like a simple and quite clean implementation. Although it's easier to use an iota for the numbering, does that open up any issues with keeping the documentation up to date? I know it's easier to program and extend, but it's also less obvious when codes change. Is there a

Re: [go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-25 Thread John Beckett
> > Since it is an HTTP Api, what about returning a standard HTTP status line, > maybe with some non standard status code) and additional details about the > error in the response body, JSON encoded? That is exactly what we do. We return a HTTP status, but in addition, we return a JSON encoded b

[go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-25 Thread Manlio Perillo
Il giorno mercoledì 25 gennaio 2017 18:16:33 UTC+1, JohnGB ha scritto: > > I have an HTTP API written in Go, and to give more fine grained responses > to the client app, we return our own error codes along with the standard > HTTP status codes Along a similar line to what Twitter does with its

[go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-25 Thread pierre . curto
Maybe use a map along the lines of: https://play.golang.org/p/YDF4q6cTyX ? Le mercredi 25 janvier 2017 18:16:33 UTC+1, JohnGB a écrit : > > I have an HTTP API written in Go, and to give more fine grained responses > to the client app, we return our own error codes along with the standard > HTTP