Skip to content

Commit

Permalink
fix(api): catch sync request errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gergelyke committed Jul 28, 2016
1 parent 27e4080 commit 37883c1
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/agent/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@ function CollectorApi (options) {
// USE THIS WITH CAUTION, IT WILL BE BLOCKING
CollectorApi.prototype._sendSync = function (destinationUrl, data) {
debug('sending data to trace servers sync: ', JSON.stringify(data))
requestSync('POST', destinationUrl, {
json: data,
headers: {
'Authorization': 'Bearer ' + this.apiKey,
'Content-Type': 'application/json',
'X-Reporter-Version': libPackage.version,
'X-Reporter-Language': this.collectorLanguage
},
timeout: 1000
})
try {
requestSync('POST', destinationUrl, {
json: data,
headers: {
'Authorization': 'Bearer ' + this.apiKey,
'Content-Type': 'application/json',
'X-Reporter-Version': libPackage.version,
'X-Reporter-Language': this.collectorLanguage
},
timeout: 1000
})
} catch (ex) {
debug('error sending data to trace servers sync: ', ex)
}
}

CollectorApi.prototype._withInstanceInfo = function (data) {
Expand Down

0 comments on commit 37883c1

Please sign in to comment.