Skip to content

Commit

Permalink
Fixed issue #47. Added default empty error handler for Requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoung committed Dec 8, 2011
1 parent 6c1a4df commit 31d14e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/restler.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function Request(uri, options) {
}

Request.prototype = new process.EventEmitter();

mixin(Request.prototype, {
_isRedirect: function(response) {
return ([301, 302, 303].indexOf(response.statusCode) >= 0);
Expand Down Expand Up @@ -175,7 +176,9 @@ function shortcutOptions(options, method) {
}

function request(url, options) {
return (new Request(url, options)).run();
var request = new Request(url, options);
request.on('error', function() {});
return request.run();
}

function get(url, options) {
Expand Down

0 comments on commit 31d14e4

Please sign in to comment.