Skip to content

Commit fb23ced

Browse files
address PR feedback
1 parent ec21135 commit fb23ced

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/error-reporting/README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,19 @@ var errors = require('@google-cloud/error-reporting')({
4444
errors.report(new Error('Something broke!'));
4545
```
4646

47-
- *One may even catch and report application-wide uncaught errors:*
47+
- **One may even catch and report application-wide uncaught errors:**
48+
- *It is recommended to catch uncaughtExceptions for production-deployed applications*
49+
- [To read more about uncaught exception handling in Node.js and what it means for your application please click here](https://nodejs.org/api/process.html#process_event_uncaughtexception)
4850

4951
```js
5052
var errors = require('@google-cloud/error-reporting')();
51-
process.on('uncaughtException', e => errors.report(e));
53+
process.on('uncaughtException', (e) => {
54+
// Write the error to stderr. If one does not manually do this
55+
// nothing will be printed before the VM exits.
56+
console.error(e);
57+
// Report that same error the Stackdriver Error Service
58+
errors.report(e);
59+
});
5260
```
5361

5462
1. **View reported errors:**

0 commit comments

Comments
 (0)