-
Notifications
You must be signed in to change notification settings - Fork 54
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
Unhandled exception should still be printed to the Console #6
Comments
I'm on the fence about this one, while its nice to see the errors, in local development the package should be not initialized. In your live environment, there's little benefit in the users of the application to see the errors, and as a developer you can see all of the errors in the stackdriver dashboard. Thoughts @steren ? |
That's a good point that in local dev, it's better to not initialize the module. I still wonder if in a scenario of troubleshooting a customer issue, it's convenient to ask the customer: "open the Chrome console, is there any errors there?". |
Very good point! |
I would definitely agree with @steren in this case, but it should be an option which could be turned off in config if someone would still want to run logging silently. |
You should not break default browser behaviour. Sometimes one need to check by himself that is an error somewhere without access to stackdriver. How could he know that this script is running and errors are suppresed? It can lead to many problems. For those who needs fix for this, just change return value of this function in source code from true to false: Line 74 in current version and then rebuild (npm run dist). |
What about just make this configurable? |
another possible workaround: import StackdriverErrorReporter from "stackdriver-errors-js";
const errorReporter = new StackdriverErrorReporter();
function startReportingUnhanldedErrors() {
// 1. report errors to stackdriver
errorReporter.start(YOUR_CONFIG);
const stackdriverErrorHandler = window.onerror;
window.onerror = () => {
stackdriverErrorHandler(...arguments);
// 2. log errors to the console (default browser behavior)
return false;
};
} |
the bad thing is that StackDriver automatically makes the decision for you, violating Inversion of Control. should be disabled by default, or configurable. |
|
Setting up this module hides errors from the Chrome console. This is not good for debugging
The text was updated successfully, but these errors were encountered: