clean up error checking around non-existent collections in api routes