diff --git a/main.js b/main.js index bcf725e08..2d4e965e1 100644 --- a/main.js +++ b/main.js @@ -303,7 +303,9 @@ Request.prototype.request = function () { if (options.timeout) { options.timeoutTimer = setTimeout(function() { options.req.abort() - options.emit("error", "ETIMEDOUT") + var e = new Error("ETIMEDOUT") + e.code = "ETIMEDOUT" + options.emit("error", e) }, options.timeout) }