Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Error bugfix to 0.1.1

  • Loading branch information...
commit 52d9393b60f05ebd73b6c3ee05647dd905cd5a47 1 parent 3105a1d
@geoffreak authored
View
2  lib/request-enhanced.js
@@ -125,7 +125,7 @@
attemptsLeft = options.maxAttempts;
}
if (attemptsLeft <= 0) {
- return callback(lastError(lastError != null ? void 0 : new Error('No attempts to fetch the URL were made')));
+ return callback((lastError != null ? lastError : new Error('No attempts to fetch the URL were made')));
}
return request(options, function(error, response, body) {
var e, _ref, _ref1, _ref2;
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "request-enhanced",
- "version": "0.1.0",
+ "version": "0.1.1",
"author": "Joshua DeVinney <admin@geoffreak.com>",
"description": "A layer on top of the request library to further abstract and simplify web requests",
"main": "./lib/request-enhanced",
View
2  src/request-enhanced.coffee
@@ -102,7 +102,7 @@ get = (options, regex, callback) ->
#
getHelper = (options, callback, attemptsLeft, lastError) ->
attemptsLeft = options.maxAttempts if not attemptsLeft?
- if attemptsLeft <= 0 then return callback (lastError if lastError? else new Error 'No attempts to fetch the URL were made')
+ if attemptsLeft <= 0 then return callback (if lastError? then lastError else new Error 'No attempts to fetch the URL were made')
request options, (error, response, body) ->
if (error && (error.code in ['ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNRESET', 'ECONNREFUSED'])) || (response && 500 <= response.statusCode < 600)
e = if error then new Error("#{error.code} error on #{options.url}") else new Error("HTTP #{response.statusCode} error fetching #{options.url}")
Please sign in to comment.
Something went wrong with that request. Please try again.