-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherr-operation-failed.ts
79 lines (73 loc) · 1.85 KB
/
err-operation-failed.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
/**
* @file Errors - ERR_OPERATION_FAILED
* @module errnode/errors/ERR_OPERATION_FAILED
* @see https://github.com/nodejs/node/blob/v22.7.0/lib/internal/errors.js#L1607
*/
import E from '#e'
import { codes } from '#src/enums'
import type {
NodeError,
NodeErrorConstructor,
Stringifiable
} from '#src/interfaces'
/**
* `ERR_OPERATION_FAILED` schema.
*
* @see {@linkcode NodeError}
* @see https://nodejs.org/api/errors.html#err_operation_failed
*
* @extends {NodeError<codes.ERR_OPERATION_FAILED>}
*/
interface ErrOperationFailed extends NodeError<codes.ERR_OPERATION_FAILED> {}
/**
* `ERR_OPERATION_FAILED` message arguments.
*
* @see {@linkcode Stringifiable}
*/
type Args = [reason: Stringifiable]
/**
* `ERR_OPERATION_FAILED` constructor.
*
* @see {@linkcode Args}
* @see {@linkcode ErrOperationFailed}
* @see {@linkcode NodeErrorConstructor}
*
* @extends {NodeErrorConstructor<ErrOperationFailed,Args>}
*/
interface ErrOperationFailedConstructor
extends NodeErrorConstructor<ErrOperationFailed, Args> {
/**
* Create a new `ERR_OPERATION_FAILED` error.
*
* @see {@linkcode ErrOperationFailed}
* @see {@linkcode Stringifiable}
*
* @param {Stringifiable} reason
* Reason for operation failure
* @return {ErrOperationFailed}
*/
new (reason: Stringifiable): ErrOperationFailed
}
/**
* `ERR_OPERATION_FAILED` model.
*
* Thrown when an operation has failed. Typically used to signal the general
* failure of an asynchronous operation.
*
* @see {@linkcode ErrOperationFailedConstructor}
*
* @type {ErrOperationFailedConstructor}
*
* @class
*/
const ERR_OPERATION_FAILED: ErrOperationFailedConstructor = E(
codes.ERR_OPERATION_FAILED,
Error,
'Operation failed: %s'
)
export {
ERR_OPERATION_FAILED as default,
type ErrOperationFailed,
type Args as ErrOperationFailedArgs,
type ErrOperationFailedConstructor
}