Skip to content

Commit

Permalink
Surface assertion error inside catch block
Browse files Browse the repository at this point in the history
This makes the test error more correct when the `then` block raises an
assertion error. The `catch` block needs to re-raise the same exception,
not swallow it and disguise it like another failure.
  • Loading branch information
mislav committed Jul 19, 2015
1 parent ee32175 commit c8ac353
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,11 @@ suite('Body mixin', function() {
response.formData()
return response.formData()
}).catch(function(error) {
assert(error instanceof TypeError, 'Promise rejected after body consumed')
if (error instanceof chai.AssertionError) {
throw error
} else {
assert(error instanceof TypeError, 'Promise rejected after body consumed')
}
})
})

Expand Down

0 comments on commit c8ac353

Please sign in to comment.