errors-reporting: Unhandled rejections are reported#2360
Conversation
matthewloring
left a comment
There was a problem hiding this comment.
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
| }); | ||
|
|
||
| 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.
matthewloring
left a comment
There was a problem hiding this comment.
LGTM with doc nit.
packages/error-reporting/README.md
Outdated
|
|
||
| ## 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.