Skip to content

Commit

Permalink
chore(debug): improve FeedError message
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno authored Apr 14, 2020
2 parents 367cec2 + 497f284 commit dad13bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/FeedError.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class FeedError extends Error {
this.name = type;
this.feed = feed;
}

toString() {
return `${this.name} : ${this.message}\n${this.feed}`;
}
}

module.exports = FeedError;
2 changes: 2 additions & 0 deletions test/unit/rss-feed-emitter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ describe('RssFeedEmitter (unit)', () => {
expect(error).to.have.property('name', 'fetch_url_error');
expect(error).to.have.property('message', 'This URL returned a 404 status code');
expect(error).to.have.property('feed', 'https://www.nintendolife.com/feeds/zelda');
expect(error.toString()).to.eq('fetch_url_error : This URL returned a 404 status code\nhttps://www.nintendolife.com/feeds/zelda');
done();
}
});
Expand All @@ -551,6 +552,7 @@ describe('RssFeedEmitter (unit)', () => {
expect(error).to.have.property('name', 'fetch_url_error');
expect(error).to.have.property('message', 'This URL returned a 500 status code');
expect(error).to.have.property('feed', 'https://www.nintendolife.com/feeds/link');
expect(error.toString()).to.eq('fetch_url_error : This URL returned a 500 status code\nhttps://www.nintendolife.com/feeds/link');
done();
}
});
Expand Down

0 comments on commit dad13bc

Please sign in to comment.