Latest merge had issue where, through rest, querying for resources by id would return an empty data array and no errors.
This occurs because db searching was switched from First() to Where(<filter>).Find(). The latter does not return gorm.ErrRecordNotFound, so our code needs a check for empty results.
This PR fixes that issue, along with some adjacent error fixes. Primarily, errors bubbled up to the rest pkg from storage should not be wrapped in eprErrors.MissingObjectError. Not all errors from the db indicate missing objects (such as connection issues), so the storage layer should interpret errors and surface what it can.
Latest merge had issue where, through rest, querying for resources by id would return an empty data array and no errors.
This occurs because db searching was switched from
First()
toWhere(<filter>).Find()
. The latter does not returngorm.ErrRecordNotFound
, so our code needs a check for empty results.This PR fixes that issue, along with some adjacent error fixes. Primarily, errors bubbled up to the rest pkg from storage should not be wrapped in
eprErrors.MissingObjectError
. Not all errors from the db indicate missing objects (such as connection issues), so the storage layer should interpret errors and surface what it can.