Commit Graph

2 Commits

Author SHA1 Message Date
Anthony Dodd bce7629682 Use subtests (can only test against go >= 1.7 now). (#63) 2017-02-17 15:11:39 -08:00
Anthony Dodd 5836d603a3
Handle type errors properly during unmarshal node.
During the `unmarshalNode` routine, various type errors may come up.
Currently they are being swallowed by the error handling mechanism.
Rework that system so that errors are actually exposed and can be
corrected without having to dive into the code.

Handle time.Time & *time.Time type errors.

Add test for unmarshalling ptr with bad type.

Final `attr` type check catch-all & tests.

Implement system for JSON API compatible errors.

This commit creates a series of structs and interfaces for representing
JSON API compatible error objects. It includes a method for emitting a
payload of error objects (according to the JSON API spec). Its algorithm
is based upon a series of interfaces which define incremental levels of
support for errors which are JSON API compatible.

Use new error type for unmarshalling errors.

Update some docs & the privacy of a func.

Don't be prescriptive on `meta`. Use map[string]interface{}.

Add a README section on errors &c.

Do not force inclusion of `title` & `detail` (use omitempty).

Update README & docs on use of pertient errors related types.

Update tests to account for these changes.

If error type is already *ErrorObject, return immediately.

Rm everything except for ErrorsPayload, ErrorObject & MarshalErrors.

Also update README & tests.

Remove a test fixture which is no longer needed.
2017-01-31 13:06:10 -06:00