Permalink
Browse files

Error bugfix to 0.1.1

  • Loading branch information...
1 parent 3105a1d commit 52d9393b60f05ebd73b6c3ee05647dd905cd5a47 @geoffreak committed Dec 6, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/request-enhanced.js
  2. +1 −1 package.json
  3. +1 −1 src/request-enhanced.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -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",
@@ -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}")

0 comments on commit 52d9393

Please sign in to comment.