Permalink
Browse files

allowing for appResponse in http(s) errors

  • Loading branch information...
1 parent b333eac commit 85da2105889f86f6be4c01b1bddd4f69c30d33ed @mckelvey committed Jun 30, 2012
Showing with 10 additions and 2 deletions.
  1. +5 −1 lib/class.instagram.coffee
  2. +5 −1 lib/class.instagram.js
View
6 lib/class.instagram.coffee
@@ -143,7 +143,11 @@ class InstagramAPI
if post_data?
request.write post_data
request.addListener 'error', (connectionException) ->
- error(connectionException, options, "_request") if connectionException.code isnt 'ENOTCONN'
+ if connectionException.code isnt 'ENOTCONN'
+ if appResponse?
+ error connectionException, options, "_request", appResponse
+ else
+ error connectionException, options, "_request"
request.end()
APIClient = new InstagramAPI
View
6 lib/class.instagram.js
@@ -190,7 +190,11 @@
if (post_data != null) request.write(post_data);
request.addListener('error', function(connectionException) {
if (connectionException.code !== 'ENOTCONN') {
- return error(connectionException, options, "_request");
+ if (appResponse != null) {
+ return error(connectionException, options, "_request", appResponse);
+ } else {
+ return error(connectionException, options, "_request");
+ }
}
});
return request.end();

0 comments on commit 85da210

Please sign in to comment.