Fixing jsdom error handling