summaryrefslogtreecommitdiff
path: root/lib/_tls_common.js
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-03-04 22:16:24 +0100
committerMichaël Zasso <targos@protonmail.com>2018-03-07 14:54:38 +0100
commit1d2fd8b65bacaf4401450edc8ed529106cbcfc67 (patch)
treedd6230e888c69ef3dc1b19de1ea8f9de7a81fd63 /lib/_tls_common.js
parentcb5f9a6d871f6b2e0da8fa72dc2e91fb37ef9713 (diff)
downloadandroid-node-v8-1d2fd8b65bacaf4401450edc8ed529106cbcfc67.tar.gz
android-node-v8-1d2fd8b65bacaf4401450edc8ed529106cbcfc67.tar.bz2
android-node-v8-1d2fd8b65bacaf4401450edc8ed529106cbcfc67.zip
lib: port remaining errors to new system
PR-URL: https://github.com/nodejs/node/pull/19137 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/_tls_common.js')
-rw-r--r--lib/_tls_common.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/_tls_common.js b/lib/_tls_common.js
index fcb6de8166..f63acad8ad 100644
--- a/lib/_tls_common.js
+++ b/lib/_tls_common.js
@@ -24,7 +24,10 @@
const { parseCertString } = require('internal/tls');
const { isArrayBufferView } = require('internal/util/types');
const tls = require('tls');
-const errors = require('internal/errors');
+const {
+ ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED,
+ ERR_INVALID_ARG_TYPE
+} = require('internal/errors').codes;
const { SSL_OP_CIPHER_SERVER_PREFERENCE } = process.binding('constants').crypto;
@@ -56,8 +59,8 @@ function SecureContext(secureProtocol, secureOptions, context) {
function validateKeyCert(value, type) {
if (typeof value !== 'string' && !isArrayBufferView(value))
- throw new errors.TypeError(
- 'ERR_INVALID_ARG_TYPE', type,
+ throw new ERR_INVALID_ARG_TYPE(
+ type,
['string', 'Buffer', 'TypedArray', 'DataView']
);
}
@@ -212,12 +215,11 @@ exports.createSecureContext = function createSecureContext(options, context) {
if (c.context.setClientCertEngine)
c.context.setClientCertEngine(options.clientCertEngine);
else
- throw new errors.Error('ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED');
+ throw new ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED();
} else if (options.clientCertEngine != null) {
- throw new errors.TypeError('ERR_INVALID_ARG_TYPE',
- 'options.clientCertEngine',
- ['string', 'null', 'undefined'],
- options.clientCertEngine);
+ throw new ERR_INVALID_ARG_TYPE('options.clientCertEngine',
+ ['string', 'null', 'undefined'],
+ options.clientCertEngine);
}
return c;