Skip to content
This repository was archived by the owner on May 18, 2020. It is now read-only.

Commit 9d905d6

Browse files
committed
API-124: Added timeout callback & updated examples
1 parent adfa8ad commit 9d905d6

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

examples/create_update_user.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ var input = { 'email': '[email protected]',
1313
};
1414

1515
sendinObj.create_update_user(input, function(err, response){
16-
console.log(response);
16+
if(err){
17+
console.log(err);
18+
} else {
19+
console.log(response);
20+
}
1721
});
1822

1923
/*

examples/delete_user.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ var sendinObj = new sendinblue(parameters);
66
var input = { 'email': '[email protected]' };
77

88
sendinObj.delete_user(input, function(err, response){
9-
console.log(response);
9+
if(err){
10+
console.log(err);
11+
} else {
12+
console.log(response);
13+
}
1014
});
1115

1216
/*

examples/get_account.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ var sendinObj = new sendinblue(parameters);
55

66
var input = {};
77
sendinObj.get_account(input, function(err, response){
8-
console.log(response);
8+
if(err){
9+
console.log(err);
10+
} else {
11+
console.log(response);
12+
}
913
});
1014

1115
/*

examples/send_email.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ var input = { 'to': { '[email protected]': 'to whom!' },
1010
};
1111

1212
sendinObj.send_email(input, function(err, response){
13-
console.log(response);
13+
if(err){
14+
console.log(err);
15+
} else {
16+
console.log(response);
17+
}
1418
});
1519

1620
/*

sendinblue-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SendinblueAPI.prototype.call = function(resource, method, input, cb) {
2323

2424
restler.request(called_url, {method: method, timeout: this.timeout, data: input, headers: {'api-key': this.api_key, 'content-type': content_type}})
2525
.on('timeout', function(ms){
26-
cb(null, 'Request timed out within '+ms+' MS');
26+
cb('Request timed out within '+ms+' MS', null);
2727
})
2828
.on('complete', function(response) {
2929
var responseObj = JSON.parse(response);

0 commit comments

Comments
 (0)