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
@@ -26,6 +30,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
26
30
27
31
**Table of contents:**
28
32
33
+
29
34
*[Quickstart](#quickstart)
30
35
*[Before you begin](#before-you-begin)
31
36
*[Installing the client library](#installing-the-client-library)
@@ -39,9 +44,9 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
39
44
40
45
### Before you begin
41
46
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
47
+
1.[Select or create a Cloud Platform project][projects].
48
+
1.[Enable the Cloud Error Reporting API][enable_api].
49
+
1.[Set up authentication with a service account][auth] so you can access the
45
50
API from your local workstation.
46
51
47
52
### Installing the client library
@@ -50,6 +55,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
50
55
npm install @google-cloud/error-reporting
51
56
```
52
57
58
+
53
59
### Using the client library
54
60
55
61
```javascript
@@ -81,22 +87,19 @@ Here's an introductory video that provides some more details:
81
87
# When Errors Are Reported
82
88
83
89
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
-
85
90
*`'production'` (default): Only report errors if the NODE_ENV environment variable is set to "production".
86
91
*`'always'`: Always report errors regardless of the value of NODE_ENV.
87
92
*`'never'`: Never report errors regardless of the value of NODE_ENV.
88
93
89
94
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.
90
95
91
96
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
-
93
97
*`false` (default): Only report errors if the NODE_ENV environment variable is set to "production".
94
98
*`true`: Always report errors regardless of the value of NODE_ENV.
95
99
96
100
See the [Configuration](#configuration) section to learn how to specify configuration options.
97
101
98
102
## Configuration
99
-
100
103
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
-
157
159
* 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.
158
160
* If the `errors.report` method is given an `Error` object, the stack trace where the error was instantiated will be used.
159
161
* If the `errors.report` method is given a string, the stack trace at the point where `errors.report` is invoked will be used.
@@ -332,7 +334,6 @@ The [longjohn](https://www.npmjs.com/package/longjohn) module can be used with t
332
334
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.
333
335
334
336
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