Better error handling for the view ads endpoint

Added properly node Error objects when there are errors. Also made sure
that an array is always returned, even if there were errors.