-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/Improve processWindowErrorEvent
#29407
Conversation
processWindowErrorEvent
processWindowErrorEvent
Maybe browser does the logging, but only if there is |
Putting draft until I have confirmed above behaviour. Definitely should backport this, otherwise some "errors" will cause errors in inside this error handler. |
As per mozilla-mobile/firefox-ios#10817 (comment), the IOS Firefox issue classifies into the |
I know you don't like such destructuring, but ErrorEvent and its properties are well defined, including in the HTML standard, so I see no issue. |
The handler also receives PromiseRejectionEvent and I see its |
Not really. The real problem is |
ps: the last time I said "no" to such syntax, the reason is the same: it make code unclear (#25253 (comment)), and introduced new bugs #25253 (comment) |
I can restore the previous |
It's pretty straightforward already. Could be made even more so by splitting into two handler functions hat converge into a logging function, but I think would be in overengineering territory. I don't see the current function as hard to read just because of this |
@delvh @yardenshoham maybe you want to give this another look as it has changed a bit since your reviews. If there no further objections, I will merge this soon. |
Please recommend ways to test |
Can be tested by installing Violentmonkey with such userscripts: // ==UserScript==
// @name Gitea error trigger 1
// @match http://localhost:3000/*
// ==/UserScript==
setTimeout(() => {
throw new Error("sync error from userscript");
}, 10000)
const divElem = document.querySelector(".repo-header");
const resizeObserver = new ResizeObserver((entries) => {
for (const entry of entries) {
entry.target.style.width = entry.contentBoxSize[0].inlineSize + 10 + "px";
}
});
resizeObserver.observe(divElem); // ==UserScript==
// @name Gitea error trigger 2
// @match http://localhost:3000/*
// ==/UserScript==
(async () => {
throw new Error("async error from userscript");
})() |
If you go on a repo page, you should also see the proper ResizeObserver error :) |
- `e.error` can be undefined in some cases which would raise an error inside this error handler, fixed that. - The displayed message mentions looking into the console, but in my case of error from `ResizeObserver` there was nothing there, so add this logging. I think this logging was once there but got lost during refactoring.
Backport #29407 by @silverwind - `e.error` can be undefined in some cases which would raise an error inside this error handler, fixed that. - The displayed message mentions looking into the console, but in my case of error from `ResizeObserver` there was nothing there, so add this logging. I think this logging was once there but got lost during refactoring. Co-authored-by: silverwind <me@silverwind.io>
* giteaofficial/main: (23 commits) Fix wrong test usage of `AppSubURL` (go-gitea#29459) Improve contrast on blame timestamp, fix double border (go-gitea#29482) Fix/Improve `processWindowErrorEvent` (go-gitea#29407) Apply compact padding to small buttons with svg icons (go-gitea#29471) Fix counter display number incorrectly displayed on the page (go-gitea#29448) Fix incorrect user location link on profile page (go-gitea#29474) Fix workflow trigger event bugs (go-gitea#29467) Fix URL calculation in clone input box (go-gitea#29470) Remove jQuery from the "find file" page (go-gitea#29456) Move generate from module to service (go-gitea#29465) The job should always run when `if` is `always()` (go-gitea#29464) Recolor dark theme to blue shade (go-gitea#29283) Let ctx.FormOptionalBool() return optional.Option[bool] (go-gitea#29461) Implement actions badge svgs (go-gitea#28102) Fix missed return (go-gitea#29450) Use tailwind instead of `gt-[wh]-` helper classes (go-gitea#29423) Lock issues and pulls faster (go-gitea#29436) Allow to change primary email before account activation (go-gitea#29412) Update docs about `DEFAULT_ACTIONS_URL` (go-gitea#29442) Only use supported sort order for "explore/users" page (go-gitea#29430) ...
e.error
can be undefined in some cases which would raise an error inside this error handler, fixed that.ResizeObserver
there was nothing there, so add this logging. I think this logging was once there but got lost during refactoring.