Unverified Commit ace3f169 authored by Ruben Bridgewater's avatar Ruben Bridgewater
Browse files

assert: improve class instance errors

This improves `assert.throws()` and `assert.rejects()` in case error
classes are used as validation for the expected error.

In case of a failure it will now throw an `AssertionError` instead
of the received error if the check fails. That error has the received
error as actual property and the expected property is set to the
expected error class.

The error message should help users to identify the problem faster
than before by providing extra context what went wrong.

PR-URL: https://github.com/nodejs/node/pull/28263


Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
Reviewed-By: default avatarBenjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
parent eb05d688
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment