| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c7323af commit de4a749
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -748,6 +748,12 @@ Used when data cannot be sent on a socket. | |||
| 748 | 748 | ||
| 749 | 749 | Used when a call is made and the UDP subsystem is not running. | |
| 750 | 750 | ||
| 751 | + <a id="ERR_NO_CRYPTO"></a> | ||
| 752 | + ### ERR_NO_CRYPTO | ||
| 753 | + | ||
| 754 | + Used when an attempt is made to use crypto features while Node.js is not | ||
| 755 | + compiled with OpenSSL crypto support. | ||
| 756 | + | ||
| 751 | 757 | <a id="ERR_STDERR_CLOSE"></a> | |
| 752 | 758 | ### ERR_STDERR_CLOSE | |
| 753 | 759 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,6 +155,7 @@ E('ERR_IPC_SYNC_FORK', 'IPC cannot be used with synchronous forks'); | |||
| 155 | 155 | E('ERR_MISSING_ARGS', missingArgs); | |
| 156 | 156 | E('ERR_PARSE_HISTORY_DATA', | |
| 157 | 157 | (oldHistoryPath) => `Could not parse history data in ${oldHistoryPath}`); | |
| 158 | + E('ERR_NO_CRYPTO', 'Node.js is not compiled with OpenSSL crypto support'); | ||
| 158 | 159 | E('ERR_STDERR_CLOSE', 'process.stderr cannot be closed'); | |
| 159 | 160 | E('ERR_STDOUT_CLOSE', 'process.stdout cannot be closed'); | |
| 160 | 161 | E('ERR_TRANSFORM_ALREADY_TRANSFORMING', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ function deprecate(fn, msg, code) { | |||
| 34 | 34 | } | |
| 35 | 35 | ||
| 36 | 36 | if (code !== undefined && typeof code !== 'string') | |
| 37 | - throw new TypeError('`code` argument must be a string'); | ||
| 37 | + throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'code', 'string'); | ||
| 38 | 38 | ||
| 39 | 39 | var warned = false; | |
| 40 | 40 | function deprecated(...args) { | |
@@ -79,7 +79,7 @@ function decorateErrorStack(err) { | |||
| 79 | 79 | ||
| 80 | 80 | function assertCrypto() { | |
| 81 | 81 | if (noCrypto) | |
| 82 | - throw new Error('Node.js is not compiled with openssl crypto support'); | ||
| 82 | + throw new errors.Error('ERR_NO_CRYPTO'); | ||
| 83 | 83 | } | |
| 84 | 84 | ||
| 85 | 85 | // The loop should only run at most twice, retrying with lowercased enc | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,16 @@ | |||
| 1 | 1 | // Flags: --expose-internals | |
| 2 | 2 | 'use strict'; | |
| 3 | - require('../common'); | ||
| 3 | + const common = require('../common'); | ||
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | const util = require('internal/util'); | |
| 6 | 6 | ||
| 7 | + const expectedError = common.expectsError({ | ||
| 8 | + code: 'ERR_NO_CRYPTO', | ||
| 9 | + type: Error | ||
| 10 | + }); | ||
| 11 | + | ||
| 7 | 12 | if (!process.versions.openssl) { | |
| 8 | - assert.throws( | ||
| 9 | - () => util.assertCrypto(), | ||
| 10 | - /^Error: Node\.js is not compiled with openssl crypto support$/ | ||
| 11 | - ); | ||
| 13 | + assert.throws(() => util.assertCrypto(), expectedError); | ||
| 12 | 14 | } else { | |
| 13 | 15 | assert.doesNotThrow(() => util.assertCrypto()); | |
| 14 | 16 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments