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

Conversation

DominicKramer
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 5, 2017
Copy link
Contributor

@matthewloring matthewloring left a comment

Choose a reason for hiding this comment

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

I think we should attach the unhandledRejection listener ourselves since it doesn't affect process termination (for now) the way uncaughtException does.

@@ -76,9 +76,13 @@ process.on('uncaughtException', (e) => {
// Report that same error the Stackdriver Error Service
errors.report(e);
});

process.on('unhandledRejection', (reason, p) => {
errors.report('Unhandled rejection of promise: ' + p + ', reason: ' + reason);

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.988% when pulling d8d24a1 on DominicKramer:docs/add-unhandledRejection-section into 03c276d on GoogleCloudPlatform:master.

@DominicKramer DominicKramer changed the title errors-report: Document unhandledRejection handling errors-reporting: Document unhandledRejection handling Jun 7, 2017
@DominicKramer DominicKramer changed the title errors-reporting: Document unhandledRejection handling errors-reporting: Unhandled rejections are reported Jun 8, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.988% when pulling 4ea2de2 on DominicKramer:docs/add-unhandledRejection-section into 03c276d on GoogleCloudPlatform:master.

*It is recommended to catch `uncaughtExceptions` for production-deployed applications.*
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.

This comment was marked as spam.

This comment was marked as spam.

var that = this;
process.on('unhandledRejection', function(reason) {
console.log('UnhandledPromiseRejectionWarning: ' +
'Unhandled promise rejection: ' + reason +

This comment was marked as spam.

This comment was marked as spam.


const ERR_TOKEN = '_@google_STACKDRIVER_INTEGRATION_TEST_ERROR__';
const TIMEOUT = 20000;
const TIMEOUT = 30000;

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

@matthewloring matthewloring left a comment

Choose a reason for hiding this comment

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

LGTM with doc nit.

@@ -64,9 +64,17 @@ errors.report(new Error('Something broke!'));

Open Stackdriver Error Reporting at https://console.cloud.google.com/errors to view the reported errors.

## Unhandled Rejections

Unhandled Rejections are reported by default. The reporting of unhandled rejections can be disabled using the `reportUnhandledRejections` configuration option. See the [Configuration](#configuration) section for more details.

This comment was marked as spam.

This comment was marked as spam.

Now unhandled rejections are reported, by default, to the error
reporting console.  The `reportUnhandledRejections` configuration
option can be used to disable the reporting of unhandled
rejections.
@DominicKramer DominicKramer force-pushed the docs/add-unhandledRejection-section branch from 3393bdf to a57d5ed Compare June 15, 2017 16:43
In particular, the configuration section, as well as the section
discussing the handling of unhandled rejections, discussed the
default behavior of handling unhandled rejections.  Now the
default action is not described in the configuration section so
that only one section describes that behavior.
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a57d5ed on DominicKramer:docs/add-unhandledRejection-section into ** on GoogleCloudPlatform:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling cb7362c on DominicKramer:docs/add-unhandledRejection-section into ** on GoogleCloudPlatform:master**.

@DominicKramer
Copy link
Contributor Author

@stephenplusplus This is ready to land. The CircleCI runs are failing with exit code 3, but the error-reporting specific tests are passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: error-reporting cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants