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

assert: throw real error in doesNotThrow() #12079

Closed
mscdex opened this issue Mar 27, 2017 · 3 comments
Closed

assert: throw real error in doesNotThrow() #12079

mscdex opened this issue Mar 27, 2017 · 3 comments
Labels
assert Issues and PRs related to the assert subsystem.

Comments

@mscdex
Copy link
Contributor

mscdex commented Mar 27, 2017

  • Version: all?
  • Platform: n/a
  • Subsystem: assert

Currently assert.doesNotThrow() does not actually throw or otherwise give the message/content of the unexpected error. Instead it just throws a 'Got unwanted error' error, which isn't really helpful. It would be nice to either throw the seen error instead (preferred) or at the very least attach the unexpected error as a property on the thrown error.

@mscdex mscdex added the assert Issues and PRs related to the assert subsystem. label Mar 27, 2017
@mscdex mscdex changed the title assert: throw error in doesNotThrow() assert: throw real error in doesNotThrow() Mar 27, 2017
@Trott
Copy link
Member

Trott commented May 27, 2017

If it throws the passed function's error instead, then is assert.doesNotThrow(fn) any different in effect from fn()? (That doesn't mean we shouldn't make this change. Just trying to get clarity.)

@refack refack self-assigned this May 28, 2017
@refack
Copy link
Contributor

refack commented May 28, 2017

IMHO it fits with #12820, we should wrap the original error in an AssertionError and provide a full stack trace. I'll follow up on this.

@BridgeAR
Copy link
Member

The alternative version got implemented in c53db1e.
I guess this can be closed?

@Trott Trott closed this as completed Aug 18, 2017
@refack refack removed their assignment Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants