Throwing exceptions when setting and fetching factories