File tree Expand file tree Collapse file tree 6 files changed +110
-0
lines changed
Expand file tree Collapse file tree 6 files changed +110
-0
lines changed Original file line number Diff line number Diff line change 5252 " ESHUTDOWN" ,
5353 " ESOCKTNOSUPPORT" ,
5454 " Odfijos" ,
55+ " errno" ,
5556 " fldv"
5657 ]
5758}
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Create [Node.js errors][1]
2222 - [ ` determineSpecificType(value) ` ] ( #determinespecifictypevalue )
2323- [ Types] ( #types )
2424 - [ Enums] ( #enums )
25+ - [ Interfaces] ( #interfaces )
2526 - [ Type Defintions] ( #type-definitions )
2627- [ Contribute] ( #contribute )
2728
@@ -323,6 +324,10 @@ This package is fully typed with [TypeScript][8]. It exports the following defin
323324- [ ` ErrorCode ` ] ( src/enums/error-code.ts )
324325- [ ` SystemErrorCode ` ] ( src/enums/error-code-system.ts )
325326
327+ ### Interfaces
328+
329+ - [ ` ErrnoException ` ] ( src/interfaces/errno-exception.ts )
330+
326331### Type Definitions
327332
328333- [ ` NodeError ` ] ( src/types/node-error.ts )
Original file line number Diff line number Diff line change 66export { default as createNodeError } from './create-node-error'
77export { default as determineSpecificType } from './determine-specific-type'
88export * from './enums'
9+ export * from './interfaces'
910export * from './types'
Original file line number Diff line number Diff line change 1+ /**
2+ * @file Type Tests - ErrnoException
3+ * @module errnode/interfaces/tests/unit-d/ErrnoException
4+ */
5+
6+ import type { SystemErrorCode } from '#src/enums'
7+ import type TestSubject from '../errno-exception'
8+
9+ describe ( 'unit-d:interfaces/ErrnoException' , ( ) => {
10+ it ( 'should extend Error' , ( ) => {
11+ expectTypeOf < TestSubject > ( ) . toMatchTypeOf < Error > ( )
12+ } )
13+
14+ it ( 'should match [code: SystemErrorCode]' , ( ) => {
15+ expectTypeOf < TestSubject > ( )
16+ . toHaveProperty ( 'code' )
17+ . toEqualTypeOf < SystemErrorCode > ( )
18+ } )
19+
20+ it ( 'should match [errno: number]' , ( ) => {
21+ expectTypeOf < TestSubject > ( ) . toHaveProperty ( 'errno' ) . toBeNumber ( )
22+ } )
23+
24+ it ( 'should match [message: string]' , ( ) => {
25+ expectTypeOf < TestSubject > ( ) . toHaveProperty ( 'message' ) . toBeString ( )
26+ } )
27+
28+ it ( 'should match [path?: string | undefined]' , ( ) => {
29+ expectTypeOf < TestSubject > ( )
30+ . toHaveProperty ( 'path' )
31+ . toEqualTypeOf < string | undefined > ( )
32+ } )
33+
34+ it ( 'should match [syscall: string]' , ( ) => {
35+ expectTypeOf < TestSubject > ( ) . toHaveProperty ( 'syscall' ) . toBeString ( )
36+ } )
37+ } )
Original file line number Diff line number Diff line change 1+ /**
2+ * @file Interfaces - ErrnoException
3+ * @module errnode/interfaces/ErrnoException
4+ */
5+
6+ import type { SystemErrorCode } from '#src/enums'
7+
8+ /**
9+ * Node.js exception model.
10+ *
11+ * @see https://github.com/nodejs/node/blob/v19.3.0/lib/internal/errors.js#L615-L619
12+ *
13+ * @extends {Error }
14+ */
15+ interface ErrnoException extends Error {
16+ /**
17+ * System error code.
18+ *
19+ * [1]: {@link ../enums/error-code-system.ts}
20+ *
21+ * @see [`SystemErrorCode`][1]
22+ */
23+ code : SystemErrorCode
24+
25+ /**
26+ * Negative number which corresponds to an error code defined in [libuv Error
27+ * handling][1].
28+ *
29+ * On Windows, the error number provided by the system will be normalized by
30+ * libuv.
31+ *
32+ * [1]: https://docs.libuv.org/en/v1.x/errors.html
33+ * [2]: https://nodejs.org/api/util.html#utilgetsystemerrornameerr
34+ */
35+ errno : number
36+
37+ /**
38+ * Error message.
39+ *
40+ * Always prefixed by {@linkcode syscall} and {@linkcode code}.
41+ *
42+ * @override
43+ */
44+ message : NonNullable < Error [ 'message' ] >
45+
46+ /**
47+ * Relevant invalid pathname (i.e. a file path when reporting a file system
48+ * error).
49+ */
50+ path ?: string | undefined
51+
52+ /**
53+ * Failed [syscall][1] description.
54+ *
55+ * [1]: https://man7.org/linux/man-pages/man2/syscalls.2.html
56+ */
57+ syscall : string
58+ }
59+
60+ export type { ErrnoException as default }
Original file line number Diff line number Diff line change 1+ /**
2+ * @file Entry Point - Interfaces
3+ * @module errnode/interfaces
4+ */
5+
6+ export type { default as ErrnoException } from './errno-exception'
You can’t perform that action at this time.
0 commit comments