Skip to content

assert: throw real error in doesNotThrow() #12079

Description

@mscdex
  • 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.

Activity

  1. added
    assertIssues and PRs related to the assert subsystem.
    on Mar 27, 2017
  2. changed the title [-]assert: throw error in doesNotThrow()[/-] [+]assert: throw real error in doesNotThrow()[/+] on Mar 27, 2017
  3. Trott commented on May 27, 2017

    @Trott
    Member

    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.)

  4. self-assigned this
    on May 28, 2017
  5. refack commented on May 28, 2017

    @refack
    Contributor

    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.

  6. BridgeAR commented on Aug 18, 2017

    @BridgeAR
    Member

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

  7. removed their assignment
    on Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    assertIssues and PRs related to the assert subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions