-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherr-encoding-not-supported.ts
76 lines (70 loc) · 2.03 KB
/
err-encoding-not-supported.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
/**
* @file Errors - ERR_ENCODING_NOT_SUPPORTED
* @module errnode/errors/ERR_ENCODING_NOT_SUPPORTED
* @see https://github.com/nodejs/node/blob/v22.7.0/lib/internal/errors.js#L1198-L1199
*/
import E from '#e'
import { codes } from '#src/enums'
import type { NodeError, NodeErrorConstructor } from '#src/interfaces'
/**
* `ERR_ENCODING_NOT_SUPPORTED` schema.
*
* @see {@linkcode NodeError}
* @see https://nodejs.org/api/errors.html#err_encoding_not_supported
*
* @extends {NodeError<codes.ERR_ENCODING_NOT_SUPPORTED>}
* @extends {RangeError}
*/
interface ErrEncodingNotSupported
extends NodeError<codes.ERR_ENCODING_NOT_SUPPORTED>, RangeError {}
/**
* `ERR_ENCODING_NOT_SUPPORTED` message arguments.
*/
type Args = [encoding: unknown]
/**
* `ERR_ENCODING_NOT_SUPPORTED` constructor.
*
* @see {@linkcode Args}
* @see {@linkcode ErrEncodingNotSupported}
* @see {@linkcode NodeErrorConstructor}
*
* @extends {NodeErrorConstructor<ErrEncodingNotSupported,Args>}
*/
interface ErrEncodingNotSupportedConstructor
extends NodeErrorConstructor<ErrEncodingNotSupported, Args> {
/**
* Create a new `ERR_ENCODING_NOT_SUPPORTED` error.
*
* @see {@linkcode ErrEncodingNotSupported}
*
* @param {unknown} encoding
* The encoding that is not supported
* @return {ErrEncodingNotSupported}
*/
new (encoding: unknown): ErrEncodingNotSupported
}
/**
* `ERR_ENCODING_NOT_SUPPORTED` model.
*
* Thrown when an encoding provided to the `TextDecoder()` API is not one of the
* [WHATWG Supported Encodings][1].
*
* [1]: https://nodejs.org/api/util.html#whatwg-supported-encodings
*
* @see {@linkcode ErrEncodingNotSupportedConstructor}
*
* @type {ErrEncodingNotSupportedConstructor}
*
* @class
*/
const ERR_ENCODING_NOT_SUPPORTED: ErrEncodingNotSupportedConstructor = E(
codes.ERR_ENCODING_NOT_SUPPORTED,
RangeError,
'The "%s" encoding is not supported'
)
export {
ERR_ENCODING_NOT_SUPPORTED as default,
type ErrEncodingNotSupported,
type Args as ErrEncodingNotSupportedArgs,
type ErrEncodingNotSupportedConstructor
}