mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
errors: use lazy assert to avoid issues on startup
Use of assert must be lazy to allow errors to be used early before the process is completely set up PR-URL: https://github.com/nodejs/node/pull/11300 Ref: https://github.com/nodejs/node/issues/11273 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
1 parent
427125491f
commit
f0b702555a
2 files changed
+9
-8
No files matched your search
@@ -125,12 +125,6 @@ assert.throws(() => {
|
||||
message: /^Error for testing 2/ }));
|
||||
}, /AssertionError: .+ does not match \S/);
|
||||
|
||||
assert.doesNotThrow(() => errors.E('TEST_ERROR_USED_SYMBOL'));
|
||||
assert.throws(
|
||||
() => errors.E('TEST_ERROR_USED_SYMBOL'),
|
||||
/^AssertionError: Error symbol: TEST_ERROR_USED_SYMBOL was already used\.$/
|
||||
);
|
||||
|
||||
// // Test ERR_INVALID_ARG_TYPE
|
||||
assert.strictEqual(errors.message('ERR_INVALID_ARG_TYPE', ['a', 'b']),
|
||||
'The "a" argument must be of type b');
|
||||
|
||||
Reference in new issue
Block a user