Skip to content

Commit

Permalink
Merge pull request #13 from polarityio/develop
Browse files Browse the repository at this point in the history
Ensure Shodan REST API errors are returned to user
  • Loading branch information
penwoodjon authored Jan 25, 2021
2 parents ac5b85b + 6eb691b commit aec3d29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function doLookup(entities, options, cb) {
const [errs, results] = transpose2DArray(requestResults);
const errors = errs.filter(
(err) =>
!_.isEmpty(err) && err && err.message === 'This job has been dropped by Bottleneck'
!_.isEmpty(err)
);

if (errors.length) {
Expand Down Expand Up @@ -116,6 +116,11 @@ const requestEntity = (entity, requestOptions, callback) =>
entity,
body: null
});
} else if (res.statusCode === 401) {
// no result found
return callback({
detail: 'Unauthorized: The provided API key is invalid.'
});
} else if (res.statusCode === 503) {
// reached request limit
return callback({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"main": "./integration.js",
"name": "shodan",
"version": "3.2.2-beta",
"version": "3.2.3-beta",
"private": true,
"dependencies": {
"bottleneck": "^2.19.5",
Expand Down

0 comments on commit aec3d29

Please sign in to comment.