Adding exceptions to factory classes