lib: throw a special error in internal/assert

Instead of using the public AssertionError, use a simplified
error that describes potential causes of these assertions
and suggests the user to open an issue.

PR-URL: https://github.com/nodejs/node/pull/26635
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Joyee Cheung authored and Ruben Bridgewater committed 2019-04-25 01:29:48 +02:00
1 parent 237d9f9716
commit b9f1e57201
12 files changed
+100 -28

No files matched your search

+2 -5
View File
@@ -78,12 +78,9 @@ common.expectsError(
assert.throws(() => tls.createServer({ ticketKeys: Buffer.alloc(0) }),
/TypeError: Ticket keys length must be 48 bytes/);
common.expectsError(
common.expectsInternalAssertion(
() => tls.createSecurePair({}),
{
code: 'ERR_ASSERTION',
message: 'context.context must be a NativeSecureContext'
}
'context.context must be a NativeSecureContext'
);
{