Skip to content

error parsing should be easier #1

@zpatrick

Description

@zpatrick

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,
))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions