Skip to content

Commit 90068dd

Browse files
authored
Merge pull request #1 from jsignanini/master
Implement error object links.
2 parents 2dcc18f + 66e21ca commit 90068dd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

errors.go

+11
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ type ErrorsPayload struct {
2323
Errors []*ErrorObject `json:"errors"`
2424
}
2525

26+
// ErrorObjectLinks is an implementation of the JSON API error links payload.
27+
//
28+
// For more information on the JSON API spec's error links objects, see: http://jsonapi.org/format/#error-objects
29+
type ErrorObjectLinks struct {
30+
// About is a link that leads to further details about this particular occurrence of the problem.
31+
About string `json:"about"`
32+
}
33+
2634
// ErrorObject is an `Error` implementation as well as an implementation of the JSON API error object.
2735
//
2836
// The main idea behind this struct is that you can use it directly in your code as an error type
@@ -45,6 +53,9 @@ type ErrorObject struct {
4553
// Code is an application-specific error code, expressed as a string value.
4654
Code string `json:"code,omitempty"`
4755

56+
// Links is an implementation of the JSON API error links payload.
57+
Links *ErrorObjectLinks `json:"links,omitempty"`
58+
4859
// Meta is an object containing non-standard meta-information about the error.
4960
Meta *map[string]interface{} `json:"meta,omitempty"`
5061
}

0 commit comments

Comments
 (0)