summaryrefslogtreecommitdiff
path: root/lib/_tls_common.js
diff options
context:
space:
mode:
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;