Restructured logic around when exceptions are thrown to manage the integration with the module manager