put this function in a `.catch` call, so that it catches issues happening in leaveActivity as well.