Put class container for errors inside of if statement