I am reading unread news using getUnreadNews() and although am not getting a error, I am getting the below returned in the response when there are no more items to be displayed -
I just want to check this is right and if it is, any idea how I can check for this to inform the user ?
Problem:
Document(s) not found for class Article with id(s) all, {:conditions=>{:is_unread=>true}}.
Summary:
When calling Article.find with an id or array of ids, each parameter must match a document in the database or this error will be raised. The search was for the id(s): all, {:conditions=>{:is_unread=>true}} … (2 total) and the following ids were not found: all, {:conditions=>{:is_unread=>true}}.
Resolution:
Search for an id that is in the database or set the Mongoid.raise_not_found_error configuration option to false, which will cause a nil to be returned instead of raising this error when searching for a single id, or only the matched documents when searching for multiples.
EDIT: Just browsing the response object and it looks like I can do this -
if event.results[“error”] ~= nil then
Dave