-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherr-unknown-module-format.ts
83 lines (77 loc) · 2.08 KB
/
err-unknown-module-format.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* @file Errors - ERR_UNKNOWN_MODULE_FORMAT
* @module errnode/errors/ERR_UNKNOWN_MODULE_FORMAT
* @see https://github.com/nodejs/node/blob/v22.7.0/lib/internal/errors.js#L1819-L1820
*/
import E from '#e'
import { codes } from '#src/enums'
import type {
NodeError,
NodeErrorConstructor,
Stringifiable
} from '#src/interfaces'
/**
* `ERR_UNKNOWN_MODULE_FORMAT` schema.
*
* @see {@linkcode NodeError}
* @see https://nodejs.org/api/errors.html#err_unknown_module_format
*
* @extends {NodeError<codes.ERR_UNKNOWN_MODULE_FORMAT>}
* @extends {RangeError}
*/
interface ErrUnknownModuleFormat
extends NodeError<codes.ERR_UNKNOWN_MODULE_FORMAT>, RangeError {}
/**
* `ERR_UNKNOWN_MODULE_FORMAT` message arguments.
*
* @see {@linkcode Stringifiable}
*/
type Args = [format: unknown, url: Stringifiable]
/**
* `ERR_UNKNOWN_MODULE_FORMAT` constructor.
*
* @see {@linkcode Args}
* @see {@linkcode ErrUnknownModuleFormat}
* @see {@linkcode NodeErrorConstructor}
*
* @extends {NodeErrorConstructor<ErrUnknownModuleFormat,Args>}
*/
interface ErrUnknownModuleFormatConstructor
extends NodeErrorConstructor<ErrUnknownModuleFormat, Args> {
/**
* Create a new `ERR_UNKNOWN_MODULE_FORMAT` error.
*
* @see {@linkcode ErrUnknownModuleFormat}
* @see {@linkcode Stringifiable}
*
* @param {unknown} format
* Unknown or unsupported format
* @param {Stringifiable} url
* Module url
* @return {ErrUnknownModuleFormat}
*/
new (format: string, url: Stringifiable): ErrUnknownModuleFormat
}
/**
* `ERR_UNKNOWN_MODULE_FORMAT` model.
*
* Thrown when an attempt is made to load a module with an unknown or
* unsupported format.
*
* @see {@linkcode ErrUnknownModuleFormatConstructor}
*
* @type {ErrUnknownModuleFormatConstructor}
*
* @class
*/
const ERR_UNKNOWN_MODULE_FORMAT: ErrUnknownModuleFormatConstructor = E(
codes.ERR_UNKNOWN_MODULE_FORMAT,
RangeError,
'Unknown module format: %s for URL %s'
)
export {
ERR_UNKNOWN_MODULE_FORMAT as default,
type ErrUnknownModuleFormat,
type Args as ErrUnknownModuleFormatArgs,
type ErrUnknownModuleFormatConstructor
}