-
Notifications
You must be signed in to change notification settings - Fork 704
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
Improve error page at loading time #1845
Conversation
client/css/style.css
Outdated
-moz-user-select: text; | ||
-ms-user-select: text; | ||
user-select: text; | ||
cursor: text; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xPaw, I'm guessing you made the pre
content-editable so people could copy-paste. I have instead made it selectable, let me know if you see something wrong in that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating these rules, can you add the selector where these are defined instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
client/js/loading-slow-alert.js
Outdated
} | ||
} | ||
|
||
var loadingSlowTimeout = setTimeout(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates a global variables (along with the function above). Wrap this entire script in an anonymous function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
client/js/loading-slow-alert.js
Outdated
error = error.message + "\n\n" + error.stack + "\n\nView developer tools console for more information and a better stacktrace."; | ||
var data = document.createElement("pre"); | ||
if (e instanceof ErrorEvent) { | ||
data.textContent = e.error && e.error.stack ? e.error.stack : e.message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't include stacktrace because it's completely useless without sourcemap loaded in, and that only loads in with devtools open before the error happens, so it's effectively very useless and misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. You did include error.stack
and that was always undefined
(at least for me), so I figured you wanted the stack trace. Want me to remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that only loads in with devtools open before the error happens
Odd, because I'm trying everything to cause this, even loading in private browsing and such, and it always shows up. Also I have a fallback if the stack is empty.
But I get your overall point. Want me to remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how it could possibly work since sourcemaps are loaded by devtools. Looking at other error reporters, they either post-process errors on server, or load sourcemap as specified in JS themselves.
So yeah, it's better off removing it since we're not making a fully fledged error reporter here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how it could possibly work since sourcemaps are loaded by devtools.
I don't know, mate, it just works 🤷♂️
But you'll notice that on the screenshot it shows the stacktrace of the built JS bundle, not the original source. That makes it less interesting for sure.
Will remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0d6303c
to
c70cc2f
Compare
client/js/loading-error-handlers.js
Outdated
loadingSlow.style.display = "block"; | ||
} | ||
|
||
displayReload(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this inside the if
above, if there is no slow message, there won't be a reload button anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I moved the button outside the block though.
I'm not 100% sure of why this if
exists: is it because we're not taking any chances and it could not exist in case of a bug? If so then maybe we should display the button even if the text wasn't found, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't do this (at least yet) per my message above. Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timer is not cancelled when the app loads, so it just does nothing if the element doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch, will do and add a comment about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
c70cc2f
to
af9f58f
Compare
- Display the "Reload page" instantly and not after 5 seconds - Remove stack trace, buggy anyway - Wrap the error details so it does not expand beyond boundaries (scrollbar would not show up either) - Do not show the slow-loading warning on error - Make zeeoe details selectable instead of editable - Label improvements
af9f58f
to
f975426
Compare
After 5 seconds: