sentry-api
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -309,3 +309,3 @@ { | ||
"file": "lib/client.js", | ||
"line": 141, | ||
"line": 149, | ||
"description": "Convenience method for making GET requests.", | ||
@@ -339,3 +339,3 @@ "itemtype": "method", | ||
"file": "lib/client.js", | ||
"line": 154, | ||
"line": 162, | ||
"description": "Convenience method for making POST requests.", | ||
@@ -369,3 +369,3 @@ "itemtype": "method", | ||
"file": "lib/client.js", | ||
"line": 167, | ||
"line": 175, | ||
"description": "Convenience method for making DELETE requests.", | ||
@@ -394,3 +394,3 @@ "itemtype": "method", | ||
"file": "lib/client.js", | ||
"line": 179, | ||
"line": 187, | ||
"description": "Convenience method for making PUT requests.", | ||
@@ -397,0 +397,0 @@ "itemtype": "method", |
@@ -133,3 +133,11 @@ var fs = require('fs'); | ||
this.logger.warn(response.statusCode, response.statusMessage); | ||
error = new Error(util.format('%d: %s', response.statusCode, response.statusMessage)); | ||
if (body && body.detail) { | ||
error = new Error(body.detail); | ||
} | ||
else if (response.statusMessage) { | ||
error = new Error(util.format('%d: %s', response.statusCode, response.statusMessage)); | ||
} | ||
else { | ||
error = new Error(response.statusCode); | ||
} | ||
callback(error); | ||
@@ -136,0 +144,0 @@ reject(error) |
{ | ||
"name": "sentry-api", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A client for the Sentry API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -37,2 +37,34 @@ var request = require('request'); | ||
exports.testError = function(test) { | ||
test.expect(2); | ||
var request = nock('https://host.com') | ||
.get('/api/0/path') | ||
.reply(400); | ||
var client = new Client('https://PUBLIC:SECRET@host.com/123'); | ||
client.request('path', {}, function(error, response) { | ||
test.ok(request.isDone(), 'Should make the correct request.'); | ||
test.equal(error.message, '400', 'Should return the error.'); | ||
test.done(); | ||
}); | ||
}; | ||
exports.testJsonError = function(test) { | ||
test.expect(2); | ||
var request = nock('https://host.com') | ||
.get('/api/0/path') | ||
.reply(400, {detail: 'bar'}); | ||
var client = new Client('https://PUBLIC:SECRET@host.com/123'); | ||
client.request('path', {}, function(error, response) { | ||
test.ok(request.isDone(), 'Should make the correct request.'); | ||
test.equal(error.message, 'bar', 'Should parse the error json.'); | ||
test.done(); | ||
}); | ||
}; | ||
exports.testGet = function(test) { | ||
@@ -39,0 +71,0 @@ test.expect(2); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1004707
13308