@@ -33,8 +33,8 @@ apigeeEdge.connect(options)
33
33
return org .developers .create (options)
34
34
.then ( (result ) => console .log (' ok. developer: ' + JSON .stringify (result)) )
35
35
})
36
- .catch ( reason => {
37
- console .log (' error: ' + reason . error . stack );
36
+ .catch ( error => {
37
+ console .log (' error: ' + error);
38
38
});
39
39
```
40
40
@@ -176,10 +176,10 @@ edgeOrg.proxies.export({name:'proxyname'})
176
176
fs .writeFileSync (path .join (' /Users/foo/export' , result .filename ), result .buffer );
177
177
console .log (' ok' );
178
178
})
179
- .catch ( reason => { console .log (reason . error );} );
179
+ .catch ( error => console .log (util . format ( error)) );
180
180
```
181
181
182
- In the case of an error, the catch() will get the reason . There will be 2 members to the reason object: error, and result. The result is the payload send back, if any.
182
+ In the case of an error, the catch() will get the Error object . There will be an additional member on the reason object: result. The result is the payload send back, if any.
183
183
184
184
using callbacks:
185
185
``` js
@@ -234,8 +234,8 @@ apigeeEdge.connect(options)
234
234
org .proxies .import ({name: opt .options .name , source: ' /tmp/path/dir' })
235
235
.then ( result =>
236
236
console .log (' import ok. %s name: %s r%d' , term, result .name , result .revision ) ) )
237
- .catch ( reason => {
238
- console .log (' error: ' + reason . error . stack );
237
+ .catch ( error => {
238
+ console .log (util . format ( error) );
239
239
});
240
240
```
241
241
@@ -276,7 +276,7 @@ var options = {
276
276
277
277
org .proxies .deploy (options)
278
278
.then ( result => console .log (' deployment succeeded.' ) )
279
- .catch reason => console .log (' deployment failed.' ) );
279
+ .catch ( error => console .log (' deployment failed. ' + error ) );
280
280
` ` `
281
281
282
282
@@ -313,11 +313,11 @@ apigeeEdge.connect(options)
313
313
items
314
314
.reduce (reducer, Promise .resolve ([]))
315
315
.then ( (arrayOfResults ) => common .logWrite (' all done...\n ' + JSON .stringify (arrayOfResults)) )
316
- .catch ( ( e ) => console .error (' error: ' + e . stack ) );
316
+ .catch ( e => console .error (' error: ' + e) );
317
317
318
318
});
319
319
})
320
- .catch ( reason => console .error (' error: ' + reason . error . stack ) );
320
+ .catch ( e => console .error (e ) );
321
321
` ` `
322
322
323
323
@@ -394,7 +394,7 @@ apigeeEdge.connect(options)
394
394
.then ( () => org .maskconfigs .add ({ namespaces : { prefix: ' apigee' , value: ' urn://apigee' } })
395
395
.then ( (result ) => console .log (JSON .stringify (result)) )
396
396
})
397
- .catch ( reason => console .log (' error: ' + reason . error . stack ) );
397
+ .catch ( e => console .log (e ) );
398
398
` ` `
399
399
400
400
### Create a Target Server
@@ -417,7 +417,7 @@ apigeeEdge.connect(options)
417
417
}
418
418
});
419
419
})
420
- .catch ( reason => console .log (' error: ' + reason . error . stack ) );
420
+ .catch ( e => console .log (e ) );
421
421
422
422
` ` `
423
423
@@ -435,8 +435,8 @@ apigeeEdge.connect(connectOptions)
435
435
.then ( result => {
436
436
...
437
437
})
438
- .catch ( reason => {
439
- console .log (' failed to create: ' + reason . error );
438
+ .catch ( e => {
439
+ console .log (' failed to create: ' + e );
440
440
});
441
441
});
442
442
` ` `
@@ -454,8 +454,8 @@ apigeeEdge.connect(connectOptions)
454
454
.then ( result => {
455
455
console .log (' attrs: ' + JSON .stringify (result .attributes ));
456
456
})
457
- .catch ( reason => {
458
- console .log (' failed to create : ' + reason . error );
457
+ .catch ( e => {
458
+ console .log (' failed to update : ' + e );
459
459
});
460
460
});
461
461
` ` `
0 commit comments