|
| 1 | +/** |
| 2 | + * @file Errors - ERR_NO_CRYPTO |
| 3 | + * @module errnode/errors/ERR_NO_CRYPTO |
| 4 | + * @see https://github.com/nodejs/node/blob/v22.8.0/lib/internal/errors.js#L1603-L1604 |
| 5 | + */ |
| 6 | + |
| 7 | +import E from '#e' |
| 8 | +import { codes } from '#src/enums' |
| 9 | +import type { NodeError, NodeErrorConstructor } from '#src/interfaces' |
| 10 | + |
| 11 | +/** |
| 12 | + * `ERR_NO_CRYPTO` schema. |
| 13 | + * |
| 14 | + * @see {@linkcode NodeError} |
| 15 | + * @see https://nodejs.org/api/errors.html#err_no_crypto |
| 16 | + * |
| 17 | + * @extends {NodeError<codes.ERR_NO_CRYPTO>} |
| 18 | + */ |
| 19 | +interface ErrNoCrypto extends NodeError<codes.ERR_NO_CRYPTO> {} |
| 20 | + |
| 21 | +/** |
| 22 | + * `ERR_NO_CRYPTO` message arguments. |
| 23 | + */ |
| 24 | +type Args = [] |
| 25 | + |
| 26 | +/** |
| 27 | + * `ERR_NO_CRYPTO` constructor. |
| 28 | + * |
| 29 | + * @see {@linkcode ErrNoCrypto} |
| 30 | + * @see {@linkcode NodeErrorConstructor} |
| 31 | + * |
| 32 | + * @extends {NodeErrorConstructor<ErrNoCrypto,Args>} |
| 33 | + */ |
| 34 | +interface ErrNoCryptoConstructor |
| 35 | + extends NodeErrorConstructor<ErrNoCrypto, Args> { |
| 36 | + /** |
| 37 | + * Create a new `ERR_NO_CRYPTO` error. |
| 38 | + * |
| 39 | + * @see {@linkcode ErrNoCrypto} |
| 40 | + * |
| 41 | + * @return {ErrNoCrypto} |
| 42 | + */ |
| 43 | + new (): ErrNoCrypto |
| 44 | +} |
| 45 | + |
| 46 | +/** |
| 47 | + * `ERR_NO_CRYPTO` model. |
| 48 | + * |
| 49 | + * Thrown when an attempt was made to use crypto features while Node.js was not |
| 50 | + * compiled with OpenSSL crypto support. |
| 51 | + * |
| 52 | + * @see {@linkcode ErrNoCryptoConstructor} |
| 53 | + * |
| 54 | + * @type {ErrNoCryptoConstructor} |
| 55 | + * |
| 56 | + * @class |
| 57 | + */ |
| 58 | +const ERR_NO_CRYPTO: ErrNoCryptoConstructor = E( |
| 59 | + codes.ERR_NO_CRYPTO, |
| 60 | + Error, |
| 61 | + 'Node.js is not compiled with OpenSSL crypto support' |
| 62 | +) |
| 63 | + |
| 64 | +export { |
| 65 | + ERR_NO_CRYPTO as default, |
| 66 | + type ErrNoCrypto, |
| 67 | + type Args as ErrNoCryptoArgs, |
| 68 | + type ErrNoCryptoConstructor |
| 69 | +} |
0 commit comments