Skip to content

Commit 7fcddf0

Browse files
DominicKramerAce Nassri
authored and
Ace Nassri
committed
chore: update README to reflect the new API (#76)
1 parent 6975b40 commit 7fcddf0

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

error-reporting/quickstart.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ function quickstart() {
2525
// On Node 6+ the following syntax can be used instead:
2626
// const {ErrorReporting} = require('@google-cloud/error-reporting');
2727

28+
// With ES6 style imports via TypeScript or Babel, the following
29+
// syntax can be used instead:
30+
// import {ErrorReporting} from '@google-cloud/error-reporting';
31+
2832
// Instantiates a client
29-
const errors = ErrorReporting();
33+
const errors = new ErrorReporting();
3034

3135
// Reports a simple error
3236
errors.report('Something broke!');

error-reporting/snippets.js

+20-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ function setupImplicit() {
2424
// On Node 6+ the following syntax can be used instead:
2525
// const {ErrorReporting} = require('@google-cloud/error-reporting');
2626

27+
// With ES6 style imports via TypeScript or Babel, the following
28+
// syntax can be used instead:
29+
// import {ErrorReporting} from '@google-cloud/error-reporting';
30+
2731
// Instantiates a client
28-
const errors = ErrorReporting();
32+
const errors = new ErrorReporting();
2933

3034
// Reports a simple error
3135
errors.report('Something broke!');
@@ -41,8 +45,12 @@ function setupExplicit() {
4145
// On Node 6+ the following syntax can be used instead:
4246
// const {ErrorReporting} = require('@google-cloud/error-reporting');
4347

48+
// With ES6 style imports via TypeScript or Babel, the following
49+
// syntax can be used instead:
50+
// import {ErrorReporting} from '@google-cloud/error-reporting';
51+
4452
// Instantiates a client
45-
const errors = ErrorReporting({
53+
const errors = new ErrorReporting({
4654
projectId: 'your-project-id',
4755
keyFilename: '/path/to/key.json',
4856
});
@@ -61,8 +69,12 @@ function manual() {
6169
// On Node 6+ the following syntax can be used instead:
6270
// const {ErrorReporting} = require('@google-cloud/error-reporting');
6371

72+
// With ES6 style imports via TypeScript or Babel, the following
73+
// syntax can be used instead:
74+
// import {ErrorReporting} from '@google-cloud/error-reporting';
75+
6476
// Instantiates a client
65-
const errors = ErrorReporting();
77+
const errors = new ErrorReporting();
6678

6779
// Use the error message builder to customize all fields ...
6880
const errorEvent = errors.event();
@@ -99,8 +111,12 @@ function express() {
99111
// On Node 6+ the following syntax can be used instead:
100112
// const {ErrorReporting} = require('@google-cloud/error-reporting');
101113

114+
// With ES6 style imports via TypeScript or Babel, the following
115+
// syntax can be used instead:
116+
// import {ErrorReporting} from '@google-cloud/error-reporting';
117+
102118
// Instantiates a client
103-
const errors = ErrorReporting();
119+
const errors = new ErrorReporting();
104120

105121
const app = express();
106122

0 commit comments

Comments
 (0)