Add test case for double triggering 'error' events