File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 1414
1515'use strict' ;
1616
17+ // [START error_reporting_quickstart]
18+ // Import the Google Cloud client library
19+ const { ErrorReporting} = require ( '@google-cloud/error-reporting' ) ;
20+
1721function quickstart ( ) {
18- // [START error_reporting_quickstart]
19- // Imports the Google Cloud client library
20- const { ErrorReporting} = require ( '@google-cloud/error-reporting' ) ;
22+ try {
23+ throw new Error ( 'Something went wrong' ) ;
24+ } catch ( exception ) {
25+ reportError ( exception ) ;
26+ }
27+ }
2128
29+ function reportError ( exception ) {
2230 // Instantiates a client
2331 const errors = new ErrorReporting ( ) ;
2432
25- // Reports a simple error
26- errors . report ( 'Something broke!' ) ;
27- // [END error_reporting_quickstart]
33+ // Reports an exception
34+ errors . report ( exception . stack ) ;
2835}
36+ // [END error_reporting_quickstart]
37+
2938quickstart ( ) ;
You can’t perform that action at this time.
0 commit comments