Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 75: cant test expected error responses because superagent throws #93

Conversation

farmisen
Copy link

#75

Gave a shot at implementing @keithamus suggestion.

@farmisen farmisen force-pushed the Issue-75_Cant_test_expected_error_responses_because_superagent_throws branch from b8bb783 to 21c27fd Compare May 14, 2016 19:22
@meeber
Copy link
Contributor

meeber commented May 14, 2016

@farmisen this looks good from a coding perspective. I'm not familiar enough with this plugin to offer a strong opinion on whether or not we actually want to move forward with this feature; we'll need to wait for @keithamus.

If he does give the green light, then we'll want the option documented in the comments, and this PR rebased into a single commit, but probably best to hold off on any of that until he pops in.

Thanks! :D

@@ -249,7 +250,7 @@ Test.prototype.then = function (onResolve, onReject) {
var self = this;
this._promise = new Test.Promise(function (resolve, reject) {
self.end(function (err, res) {
if (err) {
if (err && self.options.badStatusCausesError) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I like this code right here - because bad statuses aren't the only cause of failure (for example timeouts, dns failures, connection closures all produce errors) - some of those errors are genuinely errors and should always fail. This should check the res.status as well.

@keithamus
Copy link
Member

@farmisen You should check out my comment in #75 here: #75 (comment). This might be a better direction to go in, as it would also support .end().

@austince
Copy link
Contributor

austince commented Sep 5, 2018

Hey @farmisen, now that #75 has been closed (and fixed with 4.0.0), would you mind if we closed this?

@vieiralucas
Copy link
Member

AS @austince suggests, I'm pretty confident this is fixed in current version.
Thank you so much for your effort @farmisen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants