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

errors-reporting: Unhandled rejections are reported #2360

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address GitHub comments
  • Loading branch information
DominicKramer committed Jun 15, 2017
commit 34d6f3793a7e36f3c839bb68fb2f219b775e31f4
2 changes: 1 addition & 1 deletion packages/error-reporting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ If unhandled rejections are set to be reported, then, when an unhandled rejectio

Uncaught exceptions are not reported by default. *It is recommended to process `uncaughtException`s for production-deployed applications.*

Note that uncaught exceptions are not reported by default because to do so would require adding a listener to the `uncaughtException` event. However, whether or not, and if so how, the addition of such a listener influences the execution of an application is specific to that particular application. As such, it is necessary for `uncaughtException`s to be reported manually.
Note that uncaught exceptions are not reported by default because to do so would require adding a listener to the `uncaughtException` event. Adding such a listener without knowledge of other `uncaughtException` listeners can cause interference between the event handlers or prevent the process from terminating cleanly. As such, it is necessary for `uncaughtException`s to be reported manually.

```js
var errors = require('@google-cloud/error-reporting')();
Expand Down
3 changes: 2 additions & 1 deletion packages/error-reporting/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ function Errors(initConfiguration) {
process.on('unhandledRejection', function(reason) {
console.log('UnhandledPromiseRejectionWarning: ' +
'Unhandled promise rejection: ' + reason +

This comment was marked as spam.

This comment was marked as spam.

'. This rejection has been reported to the error-reporting console.');
'. This rejection has been reported to the ' +
'Google Cloud Platform error-reporting console.');
that.report(reason);
});
}
Expand Down
3 changes: 2 additions & 1 deletion packages/error-reporting/system-test/testAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@ describe('error-reporting', function() {
setImmediate(function() {
var expected = 'UnhandledPromiseRejectionWarning: Unhandled ' +
'promise rejection: ' + rejectValue +
'. This rejection has been reported to the error-reporting console.';
'. This rejection has been reported to the ' +
'Google Cloud Platform error-reporting console.';
assert.notStrictEqual(logOutput.indexOf(expected), -1);
verifyServerResponse(function(message) {
return message.startsWith(rejectValue);
Expand Down