Skip to content

Commit

Permalink
Merge pull request #1 from jsignanini/master
Browse files Browse the repository at this point in the history
Implement error object links.
  • Loading branch information
timrourke authored Jun 10, 2018
2 parents 2dcc18f + 66e21ca commit 90068dd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ type ErrorsPayload struct {
Errors []*ErrorObject `json:"errors"`
}

// ErrorObjectLinks is an implementation of the JSON API error links payload.
//
// For more information on the JSON API spec's error links objects, see: http://jsonapi.org/format/#error-objects
type ErrorObjectLinks struct {
// About is a link that leads to further details about this particular occurrence of the problem.
About string `json:"about"`
}

// ErrorObject is an `Error` implementation as well as an implementation of the JSON API error object.
//
// The main idea behind this struct is that you can use it directly in your code as an error type
Expand All @@ -45,6 +53,9 @@ type ErrorObject struct {
// Code is an application-specific error code, expressed as a string value.
Code string `json:"code,omitempty"`

// Links is an implementation of the JSON API error links payload.
Links *ErrorObjectLinks `json:"links,omitempty"`

// Meta is an object containing non-standard meta-information about the error.
Meta *map[string]interface{} `json:"meta,omitempty"`
}
Expand Down

0 comments on commit 90068dd

Please sign in to comment.