-
Notifications
You must be signed in to change notification settings - Fork 592
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
errors-reporting: Unhandled rejections are reported #2360
Conversation
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 think we should attach the unhandledRejection
listener ourselves since it doesn't affect process termination (for now) the way uncaughtException
does.
packages/error-reporting/README.md
Outdated
@@ -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.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/README.md
Outdated
*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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
LGTM with doc nit.
packages/error-reporting/README.md
Outdated
@@ -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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
3393bdf
to
a57d5ed
Compare
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.
Changes Unknown when pulling a57d5ed on DominicKramer:docs/add-unhandledRejection-section into ** on GoogleCloudPlatform:master**. |
Changes Unknown when pulling cb7362c on DominicKramer:docs/add-unhandledRejection-section into ** on GoogleCloudPlatform:master**. |
@stephenplusplus This is ready to land. The CircleCI runs are failing with exit code 3, but the error-reporting specific tests are passing. |
No description provided.