summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-11-29 12:02:04 -0800
committerRich Trott <rtrott@gmail.com>2019-12-01 12:07:14 -0800
commitd25db11312e9ef4392042380b812359fad103707 (patch)
tree9ecc10f34c7fc7deeb2084cb95f64df577d04243 /test
parent7da6630aa4a3ba7f866be3af83ccd812102c281b (diff)
downloadandroid-node-v8-d25db11312e9ef4392042380b812359fad103707.tar.gz
android-node-v8-d25db11312e9ef4392042380b812359fad103707.tar.bz2
android-node-v8-d25db11312e9ef4392042380b812359fad103707.zip
tls: introduce ERR_TLS_INVALID_CONTEXT
It is trivially possible to cause an internal assertion error with tls.createSecurePair(). Throw a friendly error instead. Reserve internal assertions for things that we believe to be impossible. PR-URL: https://github.com/nodejs/node/pull/30718 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-tls-basic-validations.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/parallel/test-tls-basic-validations.js b/test/parallel/test-tls-basic-validations.js
index 925c6643a1..c4e2833464 100644
--- a/test/parallel/test-tls-basic-validations.js
+++ b/test/parallel/test-tls-basic-validations.js
@@ -78,9 +78,13 @@ common.expectsError(
assert.throws(() => tls.createServer({ ticketKeys: Buffer.alloc(0) }),
/TypeError: Ticket keys length must be 48 bytes/);
-common.expectsInternalAssertion(
+assert.throws(
() => tls.createSecurePair({}),
- 'context.context must be a NativeSecureContext'
+ {
+ message: 'context must be a SecureContext',
+ code: 'ERR_TLS_INVALID_CONTEXT',
+ name: 'TypeError',
+ }
);
{