aronbalog / Vox

Swift JSON:API client framework
http://jsonapi.org
MIT License
46 stars 19 forks source link

JSONAPI error handling #10

Closed Thiryn closed 6 years ago

Thiryn commented 6 years ago

It doesn't seems like Vox handles error with a JSONAPI format. From the specification an error object may look like:

{
    "errors": [
        {
            "id": "BAD",
            "links": {
                "about": "https://my.api/kb/BAD"
            },
            "status": "400",
            "code": "BAD-ERROR-CODE",
            "title": "bad attribute",
            "detail": "name can't be blank",
            "source": {
                "pointer": "/data/attributes/name"
            },
            "meta": {}
        }
    ]
}

For now, on error the data is deserialized as a DataSource's resource type, see here.

Thiryn commented 6 years ago

My bad, it is specified in the documentation. It should be clearer though, it should be more explicit.