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
Copy file name to clipboardExpand all lines: .readme-partials.yaml
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,23 @@
1
1
introduction: |-
2
2
> Node.js idiomatic client for [Error Reporting][product-docs].
3
3
4
-
[Stackdriver Error Reporting](https://cloud.google.com/error-reporting/docs/) aggregates and displays errors produced in your running cloud services.
4
+
[Cloud Error Reporting](https://cloud.google.com/error-reporting/docs/) aggregates and displays errors produced in your running cloud services.
5
5
6
6
body: |-
7
-
This module provides custom Stackdriver Error Reporting support for Node.js applications.
8
-
[Stackdriver Error Reporting](https://cloud.google.com/error-reporting/) is a feature of
7
+
This module provides custom Cloud Error Reporting support for Node.js applications.
8
+
[Cloud Error Reporting](https://cloud.google.com/error-reporting/) is a feature of
9
9
Google Cloud Platform that allows in-depth monitoring and viewing of errors reported by
10
10
applications running in almost any environment.
11
11
12
12
However, note that [@google-cloud/logging-winston](https://github.com/googleapis/nodejs-logging-winston) and [@google-cloud/logging-bunyan](https://github.com/googleapis/nodejs-logging-bunyan) automatically integrate with the Error Reporting service for Error objects logged at severity `error` or higher, for applications running on Google Cloud Platform.
13
13
14
14
Thus, if you are already using Winston or Bunyan in your application, and don't need custom error reporting capabilities, you do not need to use the `@google-cloud/error-reporting` library directly to report errors to the Error Reporting Console.
Read more about the client libraries for Cloud APIs, including the older
@@ -30,7 +26,6 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
30
26
31
27
**Table of contents:**
32
28
33
-
34
29
*[Quickstart](#quickstart)
35
30
*[Before you begin](#before-you-begin)
36
31
*[Installing the client library](#installing-the-client-library)
@@ -44,9 +39,9 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
44
39
45
40
### Before you begin
46
41
47
-
1.[Select or create a Cloud Platform project][projects].
48
-
1.[Enable the Stackdriver Error Reporting API][enable_api].
49
-
1.[Set up authentication with a service account][auth] so you can access the
42
+
1.[Select or create a Cloud Platform project][projects].
43
+
1.[Enable the Cloud Error Reporting API][enable_api].
44
+
1.[Set up authentication with a service account][auth] so you can access the
50
45
API from your local workstation.
51
46
52
47
### Installing the client library
@@ -55,7 +50,6 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
55
50
npm install @google-cloud/error-reporting
56
51
```
57
52
58
-
59
53
### Using the client library
60
54
61
55
```javascript
@@ -69,37 +63,40 @@ const errors = new ErrorReporting();
69
63
errors.report('Something broke!');
70
64
71
65
```
72
-
This module provides custom Stackdriver Error Reporting support for Node.js applications.
73
-
[Stackdriver Error Reporting](https://cloud.google.com/error-reporting/) is a feature of
66
+
This module provides custom Cloud Error Reporting support for Node.js applications.
67
+
[Cloud Error Reporting](https://cloud.google.com/error-reporting/) is a feature of
74
68
Google Cloud Platform that allows in-depth monitoring and viewing of errors reported by
75
69
applications running in almost any environment.
76
70
77
71
However, note that [@google-cloud/logging-winston](https://github.com/googleapis/nodejs-logging-winston) and [@google-cloud/logging-bunyan](https://github.com/googleapis/nodejs-logging-bunyan) automatically integrate with the Error Reporting service for Error objects logged at severity `error` or higher, for applications running on Google Cloud Platform.
78
72
79
73
Thus, if you are already using Winston or Bunyan in your application, and don't need custom error reporting capabilities, you do not need to use the `@google-cloud/error-reporting` library directly to report errors to the Error Reporting Console.
Here's an introductory video that provides some more details:
84
78
85
-
[](https://www.youtube.com/watch?v=cVpWVD75Hs8)
79
+
[](https://www.youtube.com/watch?v=cVpWVD75Hs8)
86
80
87
81
# When Errors Are Reported
88
82
89
83
The `reportMode` configuration option is used to specify when errors are reported to the Error Reporting Console. It can have one of three values:
84
+
90
85
*`'production'` (default): Only report errors if the NODE_ENV environment variable is set to "production".
91
86
*`'always'`: Always report errors regardless of the value of NODE_ENV.
92
87
*`'never'`: Never report errors regardless of the value of NODE_ENV.
93
88
94
89
The `reportMode` configuration option replaces the deprecated `ignoreEnvironmentCheck` configuration option. If both the `reportMode` and `ignoreEnvironmentCheck` options are specified, the `reportMode` configuration option takes precedence.
95
90
96
91
The `ignoreEnvironmentCheck` option should not be used. However, if it is used, and the `reportMode` option is not specified, it can have the values:
92
+
97
93
*`false` (default): Only report errors if the NODE_ENV environment variable is set to "production".
98
94
*`true`: Always report errors regardless of the value of NODE_ENV.
99
95
100
96
See the [Configuration](#configuration) section to learn how to specify configuration options.
101
97
102
98
## Configuration
99
+
103
100
The following code snippet lists available configuration options. All configuration options are optional.
The stack trace associated with an error can be viewed in the error reporting console.
156
+
159
157
* If the `errors.report` method is given an `ErrorMessage` object built using the `errors.event` method, the stack trace at the point where the error event was constructed will be used.
160
158
* If the `errors.report` method is given an `Error` object, the stack trace where the error was instantiated will be used.
161
159
* If the `errors.report` method is given a string, the stack trace at the point where `errors.report` is invoked will be used.
@@ -297,7 +295,7 @@ const errors = new ErrorReporting();
297
295
process.on('uncaughtException', (e) => {
298
296
// Write the error to stderr.
299
297
console.error(e);
300
-
// Report that same error the Stackdriver Error Service
298
+
// Report that same error the Cloud Error Service
301
299
errors.report(e);
302
300
});
303
301
```
@@ -334,6 +332,7 @@ The [longjohn](https://www.npmjs.com/package/longjohn) module can be used with t
334
332
Before reporting an `Error` object using the `report` method of the `@google-cloud/error-reporting` module, the stack trace needs to modified to remove this special line added by `longjohn`. Since the `longjohn` module can be configured to have a custom line indicating an async jump, the process of removing the custom line should be handled by the user of the `longjohn` module.
335
333
336
334
The following code illustrates how to update an `Error`'s stack trace, to remove the default line of dashes added by `longjohn` to indicate an async jump, before reporting the error.
0 commit comments