Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fixed uncaught error when parsing certain URLs #33

Closed
wants to merge 1 commit into from

2 participants

Patrick O'Doherty Dan MacTough
Patrick O'Doherty

Found an issue when parsing certain URLs.

The problem first presented itself when parsing https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=patrickod. It would fail with an uncaught error in main.js around line 1143 trying to get a status code for the returned response.

Now it checks that the STATUS_CODES object exists before trying to use it.

Dan MacTough
Owner

I don't know what API changed, but a better solution was to just use the core HTTP module directly to look up the status code. Thanks for raising the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 27, 2012
Patrick O'Doherty patrickod Fixed an unexpected bug where response.request.httpModule.STATUS_CODE…
…S was undefined
d63acc6
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. +5 1 main.js
6 main.js
@@ -1140,7 +1140,11 @@ FeedParser.parseUrl = function (url, options, callback) {
1140 1140 var handleResponse = function (response) {
1141 1141 fp.emit('response', response);
1142 1142 var code = response.statusCode;
1143   - var codeReason = response.request.httpModule.STATUS_CODES[code] || 'Unknown Failure';
  1143 + if (response.request.httpModule.STATUS_CODES != undefined) {
  1144 + var codeReason = response.request.httpModule.STATUS_CODES[code] || 'Unknown Failure';
  1145 + } else {
  1146 + var codeReason = "Unknown Failure"
  1147 + }
1144 1148 var contentType = response.headers && response.headers['content-type'];
1145 1149 var e = new Error();
1146 1150 if (code !== 200) {

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.