|
| 1 | +/** |
| 2 | + * @file Errors - ERR_INVALID_FILE_URL_PATH |
| 3 | + * @module errnode/errors/ERR_INVALID_FILE_URL_PATH |
| 4 | + * @see https://github.com/nodejs/node/blob/v22.8.0/lib/internal/errors.js#L1472 |
| 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_INVALID_FILE_URL_PATH` schema. |
| 13 | + * |
| 14 | + * @see {@linkcode NodeError} |
| 15 | + * @see https://nodejs.org/api/errors.html#err_invalid_file_url_path |
| 16 | + * |
| 17 | + * @extends {NodeError<codes.ERR_INVALID_FILE_URL_PATH>} |
| 18 | + * @extends {TypeError} |
| 19 | + */ |
| 20 | +interface ErrInvalidFileUrlPath |
| 21 | + extends NodeError<codes.ERR_INVALID_FILE_URL_PATH>, TypeError {} |
| 22 | + |
| 23 | +/** |
| 24 | + * `ERR_INVALID_FILE_URL_PATH` message arguments. |
| 25 | + */ |
| 26 | +type Args = [reason: string] |
| 27 | + |
| 28 | +/** |
| 29 | + * `ERR_INVALID_FILE_URL_PATH` constructor. |
| 30 | + * |
| 31 | + * @see {@linkcode ErrInvalidFileUrlPath} |
| 32 | + * @see {@linkcode NodeErrorConstructor} |
| 33 | + * |
| 34 | + * @extends {NodeErrorConstructor<ErrInvalidFileUrlPath,Args>} |
| 35 | + */ |
| 36 | +interface ErrInvalidFileUrlPathConstructor |
| 37 | + extends NodeErrorConstructor<ErrInvalidFileUrlPath, Args> { |
| 38 | + /** |
| 39 | + * Create a new `ERR_INVALID_FILE_URL_PATH` error. |
| 40 | + * |
| 41 | + * @see {@linkcode ErrInvalidFileUrlPath} |
| 42 | + * |
| 43 | + * @param {string} reason |
| 44 | + * Reason for invalidity |
| 45 | + * @return {ErrInvalidFileUrlPath} |
| 46 | + */ |
| 47 | + new (reason: string): ErrInvalidFileUrlPath |
| 48 | +} |
| 49 | + |
| 50 | +/** |
| 51 | + * `ERR_INVALID_FILE_URL_PATH` model. |
| 52 | + * |
| 53 | + * Thrown when a Node.js API that consumes `file:` URLs encountered a file URL |
| 54 | + * with an incompatible path. |
| 55 | + * The exact semantics for determining whether a path can be used is |
| 56 | + * platform-dependent. |
| 57 | + * |
| 58 | + * @see {@linkcode ErrInvalidFileUrlPathConstructor} |
| 59 | + * |
| 60 | + * @type {ErrInvalidFileUrlPathConstructor} |
| 61 | + * |
| 62 | + * @class |
| 63 | + */ |
| 64 | +const ERR_INVALID_FILE_URL_PATH: ErrInvalidFileUrlPathConstructor = E( |
| 65 | + codes.ERR_INVALID_FILE_URL_PATH, |
| 66 | + TypeError, |
| 67 | + 'File URL path %s' |
| 68 | +) |
| 69 | + |
| 70 | +export { |
| 71 | + ERR_INVALID_FILE_URL_PATH as default, |
| 72 | + type ErrInvalidFileUrlPath, |
| 73 | + type Args as ErrInvalidFileUrlPathArgs, |
| 74 | + type ErrInvalidFileUrlPathConstructor |
| 75 | +} |
0 commit comments