Adds exception handling to ModuleFactory.pm