Adding error handling to core.modules.js