Closed mreichelt closed 8 years ago
When a ResourceNotFoundException
thrown from get()
it means that the referenced resource is not provided by Document
or there is not document related with current Resource
object. When there is a null
value of a relationship the value of HasOne<>
/HasMany<>
should be null
, and there's no matter with ResourceNotFoundException
.
UPDATE I've update the document. We're now returning null
when HasOne/HasMany
cannot found resources. ResourceNotFoundException
is reserved for Document.find(String, String)
@kamikat Thanks!
Document.find(String, String)
is a good example for my case: It should behave nearly like a Map in Java – which returns null if a value can not be found.
@kamikat I added PR https://github.com/kamikat/moshi-jsonapi/pull/25 for a simple merge-and-be-happy if you like the change. :)
Instead of using
ResourceNotFoundException
I suggest we should simply returnnull
instead. Reasons: