Skip to content

Commit ec72d59

Browse files
committed
Merge pull request #30 from brandonbloom/messages
Improve ErrTypeMismatch error message
2 parents 564f8a8 + 5b0e148 commit ec72d59

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

request.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
const unsuportedStructTagMsg = "Unsupported jsonapi tag annotation, %s"
1616

1717
var (
18-
ErrTypeMismatch = errors.New("Trying to Unmarshal a type that does not match")
1918
ErrInvalidTime = errors.New("Only numbers can be parsed as dates, unix timestamps")
2019
ErrUnknownFieldNumberType = errors.New("The struct field was not of a known number type")
2120
)
@@ -157,7 +156,7 @@ func unmarshalNode(data *Node, model reflect.Value, included *map[string]*Node)
157156
}
158157

159158
if data.Type != args[1] {
160-
er = ErrTypeMismatch
159+
er = fmt.Errorf("Trying to Unmarshal an object of type %#v, but %#v does not match", data.Type, args[1])
161160
break
162161
}
163162

0 commit comments

Comments
 (0)