Wrap 'event = new Event(type)' in try-catch.