rclient
rclient copied to clipboard
error parsing should be easier
Right now, you need to totally override the request reader if you want to read custom error types. It should be more simple to try and marshal into errors. Perhaps a request option:
var resp int
var myerr *MyCustomError
client.Get("/path", &resp, rclient.Error(&myerr))
Another option could map status codes to types:
client.Get("/path", &resp, rclient.StatusMap(
series.Ints(200, 299): &someType,
series.Ints(400, 499): &someError,
series.Ints(500, 599): &someOtherError,
))