René's URL Explorer Experiment


Title: Thrown error no longer propagates (caught in the try-catch inside invokeTask in patchEventTarget in events.ts) · Issue #41867 · angular/angular · GitHub

Open Graph Title: Thrown error no longer propagates (caught in the try-catch inside invokeTask in patchEventTarget in events.ts) · Issue #41867 · angular/angular

X Title: Thrown error no longer propagates (caught in the try-catch inside invokeTask in patchEventTarget in events.ts) · Issue #41867 · angular/angular

Description: I have an application that performs validation on mouse events. If validation fails, it throws an Error. We catch thrown errors in our application by doing: window.addEventListener('error', (event) => { handleUncaughtError(event, logger)...

Open Graph Description: I have an application that performs validation on mouse events. If validation fails, it throws an Error. We catch thrown errors in our application by doing: window.addEventListener('error', (event)...

X Description: I have an application that performs validation on mouse events. If validation fails, it throws an Error. We catch thrown errors in our application by doing: window.addEventListener('error',...

Opengraph URL: https://github.com/angular/angular/issues/41867

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Thrown error no longer propagates (caught in the try-catch inside invokeTask in patchEventTarget in events.ts)","articleBody":"I have an application that performs validation on mouse events. If validation fails, it throws an Error. We catch thrown errors in our application by doing:\r\n`window.addEventListener('error', (event) => {\r\n      handleUncaughtError(event, logger);\r\n    });`\r\n\r\nThis worked fine: task.invoke() in the below code would call into our code, which would throw an error and would be caught by the above listener.\r\n```\r\nvar invokeTask = function (task, target, event) {\r\n        // for better performance, check isRemoved which is set\r\n        // by removeEventListener\r\n        if (task.isRemoved) {\r\n            return;\r\n        }\r\n        var delegate = task.callback;\r\n        if (typeof delegate === 'object' && delegate.handleEvent) {\r\n            // create the bind version of handleEvent when invoke\r\n            task.callback = function (event) { return delegate.handleEvent(event); };\r\n            task.originalDelegate = delegate;\r\n        }\r\n        // invoke static task.invoke\r\n        task.invoke(task, target, [event]);\r\n        var options = task.options;\r\n        if (options && typeof options === 'object' && options.once) {\r\n            // if options.once is true, after invoke once remove listener here\r\n            // only browser need to do this, nodejs eventEmitter will cal removeListener\r\n            // inside EventEmitter.once\r\n            var delegate_1 = task.originalDelegate ? task.originalDelegate : task.callback;\r\n            target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate_1, options);\r\n        }\r\n    };\r\n```\r\n\r\nHowever, now the callsite for task.invoke() looks like:\r\n```\r\nvar invokeTask = function (task, target, event) {\r\n        // for better performance, check isRemoved which is set\r\n        // by removeEventListener\r\n        if (task.isRemoved) {\r\n            return;\r\n        }\r\n        var delegate = task.callback;\r\n        if (typeof delegate === 'object' && delegate.handleEvent) {\r\n            // create the bind version of handleEvent when invoke\r\n            task.callback = function (event) { return delegate.handleEvent(event); };\r\n            task.originalDelegate = delegate;\r\n        }\r\n        // invoke static task.invoke\r\n        // need to try/catch error here, otherwise, the error in one event listener\r\n        // will break the executions of the other event listeners. Also error will\r\n        // not remove the event listener when `once` options is true.\r\n        var error;\r\n        try {\r\n            task.invoke(task, target, [event]);\r\n        }\r\n        catch (err) {\r\n            error = err;\r\n        }\r\n        var options = task.options;\r\n        if (options && typeof options === 'object' && options.once) {\r\n            // if options.once is true, after invoke once remove listener here\r\n            // only browser need to do this, nodejs eventEmitter will cal removeListener\r\n            // inside EventEmitter.once\r\n            var delegate_1 = task.originalDelegate ? task.originalDelegate : task.callback;\r\n            target[REMOVE_EVENT_LISTENER].call(target, event.type, delegate_1, options);\r\n        }\r\n        return error;\r\n    };\r\n```\r\n\r\nand it seems like the error is ignored in globalCallback()\r\n\r\n```\r\nfunction globalCallback(context, event, isCapture) {\r\n        // https://github.com/angular/zone.js/issues/911, in IE, sometimes\r\n        // event will be undefined, so we need to use window.event\r\n        event = event || _global.event;\r\n        if (!event) {\r\n            return;\r\n        }\r\n        // event.target is needed for Samsung TV and SourceBuffer\r\n        // || global is needed https://github.com/angular/zone.js/issues/190\r\n        var target = context || event.target || _global;\r\n        var tasks = target[exports.zoneSymbolEventNames[event.type][isCapture ? utils_1.TRUE_STR : utils_1.FALSE_STR]];\r\n        if (tasks) {\r\n            // invoke all tasks which attached to current target with given event.type and capture = false\r\n            // for performance concern, if task.length === 1, just invoke\r\n            if (tasks.length === 1) {\r\n                invokeTask(tasks[0], target, event);\r\n            }\r\n            else {\r\n                // https://github.com/angular/zone.js/issues/836\r\n                // copy the tasks array before invoke, to avoid\r\n                // the callback will remove itself or other listener\r\n                var copyTasks = tasks.slice();\r\n                var errors = [];\r\n                for (var i = 0; i \u003c copyTasks.length; i++) {\r\n                    if (event && event[IMMEDIATE_PROPAGATION_SYMBOL] === true) {\r\n                        break;\r\n                    }\r\n                    var err = invokeTask(copyTasks[i], target, event);\r\n                    err && errors.push(err);\r\n                }\r\n                var _loop_1 = function (i) {\r\n                    var err = errors[i];\r\n                    api.nativeScheduleMicroTask(function () {\r\n                        throw err;\r\n                    });\r\n                };\r\n                for (var i = 0; i \u003c errors.length; i++) {\r\n                    _loop_1(i);\r\n                }\r\n            }\r\n        }\r\n    }\r\n```\r\n\r\nIIUC, this is caused by the fix for this https://github.com/angular/angular/pull/41562#issuecomment-822696973\r\n\r\nThis is a regression (I tested with a version from 3 weeks ago and it worked as expected).\r\n\r\nCan we ensure that all caught errors are rethrown? Or whatever is the Angular way to undo this regression.","author":{"url":"https://github.com/br-star","@type":"Person","name":"br-star"},"datePublished":"2021-04-28T23:00:22Z","url":"https://github.com/angular/angular/issues/41867"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:09e8cbb1-10a2-13fd-c3ed-6e904d4cc503
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC2B0:1AE20C:C6F336:FCFEB6:6B00FCC2
html-safe-nonce554b6851f732f3397747062458b1452669df12b46d6f0882041bccb2b0cf86b1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkIwOjFBRTIwQzpDNkYzMzY6RkNGRUI2OjZCMDBGQ0MyIiwidmlzaXRvcl9pZCI6IjYzNDc4ODMxODc2NDA3OTQzMDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac52159cfed807ab340959e6b41e388416e3a2ae58544bbfdc579b6c104709632b
hovercard-subject-tagissue:870468186
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/41867/issue_layout
twitter:imagehttps://opengraph.githubassets.com/945adc58e717378a08931706660e828c63ea653c09b2a86a237f44301695b2a3/angular/angular/issues/41867
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/945adc58e717378a08931706660e828c63ea653c09b2a86a237f44301695b2a3/angular/angular/issues/41867
og:image:altI have an application that performs validation on mouse events. If validation fails, it throws an Error. We catch thrown errors in our application by doing: window.addEventListener('error', (event)...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebr-star
hostnamegithub.com
expected-hostnamegithub.com
Nonee208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7dafd017fb7809a839c443dba08622af38e63c09
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/41867#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F41867
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F41867
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/41867
Reloadhttps://github.com/angular/angular/issues/41867
Reloadhttps://github.com/angular/angular/issues/41867
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/41867
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/41867
Thrown error no longer propagates (caught in the try-catch inside invokeTask in patchEventTarget in events.ts)https://github.com/angular/angular/issues/41867#top
https://github.com/JiaLiPassion
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
area: zonesIssues related to zone.jshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20zones%22
regressionIndicates than the issue relates to something that worked in a previous versionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22regression%22
state: confirmedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20confirmed%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/br-star
br-starhttps://github.com/br-star
on Apr 28, 2021https://github.com/angular/angular/issues/41867#issue-870468186
#41562 (comment)https://github.com/angular/angular/pull/41562#issuecomment-822696973
jessicajaniukhttps://github.com/jessicajaniuk
area: zonesIssues related to zone.jshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20zones%22
on Apr 28, 2021https://github.com/angular/angular/issues/41867#event-4659652843
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Apr 28, 2021https://github.com/angular/angular/issues/41867#event-4659652886
jessicajaniukhttps://github.com/jessicajaniuk
JiaLiPassionhttps://github.com/JiaLiPassion
on Apr 28, 2021https://github.com/angular/angular/issues/41867#event-4659653150
https://github.com/JiaLiPassion
JiaLiPassionhttps://github.com/JiaLiPassion
on Apr 28, 2021https://github.com/angular/angular/issues/41867#issuecomment-828850910
@br-starhttps://github.com/br-star
https://github.com/br-star
br-starhttps://github.com/br-star
on Apr 28, 2021https://github.com/angular/angular/issues/41867#issuecomment-828854464
https://github.com/JiaLiPassion
JiaLiPassionhttps://github.com/JiaLiPassion
on Apr 29, 2021https://github.com/angular/angular/issues/41867#issuecomment-828859517
@br-starhttps://github.com/br-star
#41562 (comment)https://github.com/angular/angular/pull/41562#issuecomment-822696973
https://github.com/br-star
br-starhttps://github.com/br-star
on Apr 29, 2021https://github.com/angular/angular/issues/41867#issuecomment-828867729
https://github.com/JiaLiPassion
JiaLiPassionhttps://github.com/JiaLiPassion
on Apr 29, 2021https://github.com/angular/angular/issues/41867#issuecomment-828869506
JiaLiPassionhttps://github.com/JiaLiPassion
state: confirmedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20confirmed%22
on Apr 29, 2021https://github.com/angular/angular/issues/41867#event-4659891189
https://github.com/br-star
br-starhttps://github.com/br-star
on Apr 29, 2021https://github.com/angular/angular/issues/41867#issuecomment-828875424
JiaLiPassionhttps://github.com/JiaLiPassion
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
on Apr 29, 2021https://github.com/angular/angular/issues/41867#event-4660161384
jessicajaniukhttps://github.com/jessicajaniuk
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
on Apr 30, 2021https://github.com/angular/angular/issues/41867#event-4671977126
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
Backloghttps://github.com/angular/angular/milestone/82
on Apr 30, 2021https://github.com/angular/angular/issues/41867#event-4671977244
AndrewKushnirhttps://github.com/AndrewKushnir
regressionIndicates than the issue relates to something that worked in a previous versionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22regression%22
on May 3, 2021https://github.com/angular/angular/issues/41867#event-4680467501
AndrewKushnirhttps://github.com/AndrewKushnir
on Jun 9, 2021https://github.com/angular/angular/issues/41867#event-4867758651
fix(zone.js): only one listener should also re-throw an error correctlyhttps://github.com/JiaLiPassion/angular/commit/ee101f8c203216a2acf76a6b52160e44ffb92a16
https://docs.github.com/articles/closing-issues-via-commit-messages
ee101f8https://github.com/JiaLiPassion/angular/commit/ee101f8c203216a2acf76a6b52160e44ffb92a16
alxhubhttps://github.com/alxhub
on Jun 10, 2021https://github.com/angular/angular/issues/41867#event-4872549684
fix(zone.js): only one listener should also re-throw an error correct…https://github.com/angular/angular/commit/e0158a1515ec56dedd6628d12773a3c560634ed0
https://docs.github.com/articles/closing-issues-via-commit-messages
e0158a1https://github.com/angular/angular/commit/e0158a1515ec56dedd6628d12773a3c560634ed0
alxhubhttps://github.com/alxhub
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
299f92chttps://github.com/angular/angular/commit/299f92c3b62a43c94cff4a204f9e41c46a159efc
on Jun 10, 2021https://github.com/angular/angular/issues/41867#event-4872549846
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jul 11, 2021https://github.com/angular/angular/issues/41867#issuecomment-877825731
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Jul 11, 2021https://github.com/angular/angular/issues/41867#event-5004304430
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/41867
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/41867
JiaLiPassionhttps://github.com/JiaLiPassion
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
area: zonesIssues related to zone.jshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20zones%22
regressionIndicates than the issue relates to something that worked in a previous versionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22regression%22
state: confirmedhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20confirmed%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.