You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error-reporting: Unhandled rejections are reported
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.
Open Stackdriver Error Reporting at https://console.cloud.google.com/errors to view the reported errors.
66
66
67
+
## Unhandled Rejections
68
+
69
+
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.
70
+
71
+
If unhandled rejections are set to be reported, then, when an unhandled rejection occurs, a message is printed to standard out indicated that an unhandled rejection had occurred and is being reported, and the value causing the rejection is reported to the error-reporting console.
72
+
67
73
## Catching and Reporting Application-wide Uncaught Errors
68
74
69
-
Uncaught exceptions and unhandled rejections are not reported by default. *It is recommended to process `uncaughtException`s and `unhandledRejection`s for production-deployed applications.*
75
+
Uncaught exceptions are not reported by default. *It is recommended to process `uncaughtException`s for production-deployed applications.*
76
+
77
+
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.
70
78
71
79
```js
72
80
var errors =require('@google-cloud/error-reporting')();
// Report that same error the Stackdriver Error Service
77
85
errors.report(e);
78
86
});
79
-
80
-
process.on('unhandledRejection', (reason, p) => {
81
-
errors.report('Unhandled rejection of promise: '+ p +', reason: '+ reason);
82
-
});
83
87
```
84
88
85
-
More information on uncaught exception handling in Node.js can be found [here](https://nodejs.org/api/process.html#process_event_uncaughtexception), and more information on unhandled promise handling can be found [here](https://nodejs.org/api/process.html#process_event_unhandledrejection).
89
+
More information about uncaught exception handling in Node.js and what it means for your application can be found [here](https://nodejs.org/api/process.html#process_event_uncaughtexception).
86
90
87
91
## Running on Google Cloud Platform
88
92
@@ -149,6 +153,9 @@ var errors = require('@google-cloud/error-reporting')({
149
153
// should be reported
150
154
// defaults to 2 (warnings)
151
155
logLevel:2,
156
+
// determines whether or not unhandled rejections are reported to the
157
+
// error-reporting console. The default value of this property is true.
0 commit comments