throw error if can't connect to mongo