Skip to content

assert: improve ifError - #18247

Closed
BridgeAR wants to merge 3 commits into
nodejs:masterfrom
BridgeAR:improve-assert-iferror
Closed

assert: improve ifError#18247
BridgeAR wants to merge 3 commits into
nodejs:masterfrom
BridgeAR:improve-assert-iferror

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Jan 19, 2018

Copy link
Copy Markdown
Member
  1. Commit:

It is hard to know where ifError is actually triggered due to the
original error being thrown.
This changes it by wrapping the original error in a AssertionError.
This has the positive effect of also making clear that it is indeed
a assertion function that triggered that error.

The original stack can still be accessed by checking the actual
property.

  1. Commit:

Show only the Error class and not errors.AssertionError.

  1. Commit:

Make ifError stricter by only accepting null and undefined from now on.
Before any truthy value was accepted.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

assert

Loading
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. notable-change PRs with changes that should be highlighted in changelogs. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants