Skip to content
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(demo): Log demo errors to the console #68

Merged
merged 1 commit into from
May 14, 2024

Conversation

joeyparrish
Copy link
Member

When a "request fails" in the demo, sometimes it is because of an exception elsewhere in the process. This logs those errors to the console so that they can be traced and fixed.

When a "request fails" in the demo, sometimes it is because of an
exception elsewhere in the process.  This logs those errors to the
console so that they can be traced and fixed.
@@ -53,6 +53,7 @@ document.addEventListener('DOMContentLoaded', () => {
window.results.textContent =
formatObjectToString(mksa.getConfiguration());
} catch (error) {
console.log(error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to use console.error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, IMO. console.error shows a backtrace to the line of the console.error call. Printing an error object, at any log level, shows the backtrace of the error itself. So using console.error on an error object gives you two different backtraces, and it gets confusing, IMO, when you expand the wrong one.

@joeyparrish joeyparrish merged commit ccfb179 into shaka-project:main May 14, 2024
7 checks passed
@joeyparrish joeyparrish deleted the log-errors branch May 14, 2024 14:29
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Oct 10, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants