Skip to content

Commit

Permalink
chore: update README to reflect the new API (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicKramer authored and Ace Nassri committed Nov 11, 2022
1 parent 6975b40 commit 7fcddf0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion error-reporting/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ function quickstart() {
// On Node 6+ the following syntax can be used instead:
// const {ErrorReporting} = require('@google-cloud/error-reporting');

// With ES6 style imports via TypeScript or Babel, the following
// syntax can be used instead:
// import {ErrorReporting} from '@google-cloud/error-reporting';

// Instantiates a client
const errors = ErrorReporting();
const errors = new ErrorReporting();

// Reports a simple error
errors.report('Something broke!');
Expand Down
24 changes: 20 additions & 4 deletions error-reporting/snippets.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ function setupImplicit() {
// On Node 6+ the following syntax can be used instead:
// const {ErrorReporting} = require('@google-cloud/error-reporting');

// With ES6 style imports via TypeScript or Babel, the following
// syntax can be used instead:
// import {ErrorReporting} from '@google-cloud/error-reporting';

// Instantiates a client
const errors = ErrorReporting();
const errors = new ErrorReporting();

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

// With ES6 style imports via TypeScript or Babel, the following
// syntax can be used instead:
// import {ErrorReporting} from '@google-cloud/error-reporting';

// Instantiates a client
const errors = ErrorReporting({
const errors = new ErrorReporting({
projectId: 'your-project-id',
keyFilename: '/path/to/key.json',
});
Expand All @@ -61,8 +69,12 @@ function manual() {
// On Node 6+ the following syntax can be used instead:
// const {ErrorReporting} = require('@google-cloud/error-reporting');

// With ES6 style imports via TypeScript or Babel, the following
// syntax can be used instead:
// import {ErrorReporting} from '@google-cloud/error-reporting';

// Instantiates a client
const errors = ErrorReporting();
const errors = new ErrorReporting();

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

// With ES6 style imports via TypeScript or Babel, the following
// syntax can be used instead:
// import {ErrorReporting} from '@google-cloud/error-reporting';

// Instantiates a client
const errors = ErrorReporting();
const errors = new ErrorReporting();

const app = express();

Expand Down

0 comments on commit 7fcddf0

Please sign in to comment.