-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(errors):
ERR_IMPORT_ATTRIBUTE_UNSUPPORTED
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
c6305f8
commit db87bd6
Showing
7 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/errors/__tests__/err-import-attribute-unsupported.spec-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @file Type Tests - ERR_IMPORT_ATTRIBUTE_UNSUPPORTED | ||
* @module errnode/errors/tests/unit-d/ERR_IMPORT_ATTRIBUTE_UNSUPPORTED | ||
*/ | ||
|
||
import { codes } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/interfaces' | ||
import type * as TestSubject from '../err-import-attribute-unsupported' | ||
|
||
describe('unit-d:errors/ERR_IMPORT_ATTRIBUTE_UNSUPPORTED', () => { | ||
describe('ERR_IMPORT_ATTRIBUTE_UNSUPPORTED', () => { | ||
it('should be ErrImportAttributeUnsupportedConstructor', () => { | ||
expectTypeOf<typeof TestSubject.default>() | ||
.toEqualTypeOf<TestSubject.ErrImportAttributeUnsupportedConstructor>() | ||
}) | ||
}) | ||
|
||
describe('ErrImportAttributeUnsupported', () => { | ||
it('should extend NodeError<codes.ERR_IMPORT_ATTRIBUTE_UNSUPPORTED>', () => { | ||
expectTypeOf<TestSubject.ErrImportAttributeUnsupported>() | ||
.toMatchTypeOf<NodeError<codes.ERR_IMPORT_ATTRIBUTE_UNSUPPORTED>>() | ||
}) | ||
|
||
it('should extend TypeError', () => { | ||
expectTypeOf<TestSubject.ErrImportAttributeUnsupported>() | ||
.toMatchTypeOf<TypeError>() | ||
}) | ||
}) | ||
|
||
describe('ErrImportAttributeUnsupportedConstructor', () => { | ||
it('should match NodeErrorConstructor', () => { | ||
// Arrange | ||
type T = TestSubject.ErrImportAttributeUnsupported | ||
type Args = TestSubject.ErrImportAttributeUnsupportedArgs | ||
|
||
// Expect | ||
expectTypeOf<TestSubject.ErrImportAttributeUnsupportedConstructor>() | ||
.toMatchTypeOf<NodeErrorConstructor<T, Args>>() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* @file Errors - ERR_IMPORT_ATTRIBUTE_UNSUPPORTED | ||
* @module errnode/errors/ERR_IMPORT_ATTRIBUTE_UNSUPPORTED | ||
* @see https://github.com/nodejs/node/blob/v22.7.0/lib/internal/errors.js#L1344-L1345 | ||
*/ | ||
|
||
import E from '#e' | ||
import { codes } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/interfaces' | ||
|
||
/** | ||
* `ERR_IMPORT_ATTRIBUTE_UNSUPPORTED` schema. | ||
* | ||
* @see {@linkcode NodeError} | ||
* @see https://nodejs.org/api/errors.html#err_import_attribute_unsupported | ||
* | ||
* @extends {NodeError<codes.ERR_IMPORT_ATTRIBUTE_UNSUPPORTED>} | ||
* @extends {TypeError} | ||
*/ | ||
interface ErrImportAttributeUnsupported | ||
extends NodeError<codes.ERR_IMPORT_ATTRIBUTE_UNSUPPORTED>, TypeError {} | ||
|
||
/** | ||
* `ERR_IMPORT_ATTRIBUTE_UNSUPPORTED` message arguments. | ||
*/ | ||
type Args = [key: string, value: string] | ||
|
||
/** | ||
* `ERR_IMPORT_ATTRIBUTE_UNSUPPORTED` constructor. | ||
* | ||
* @see {@linkcode Args} | ||
* @see {@linkcode ErrImportAttributeUnsupported} | ||
* @see {@linkcode NodeErrorConstructor} | ||
* | ||
* @extends {NodeErrorConstructor<ErrImportAttributeUnsupported,Args>} | ||
*/ | ||
interface ErrImportAttributeUnsupportedConstructor | ||
extends NodeErrorConstructor<ErrImportAttributeUnsupported, Args> { | ||
/** | ||
* Create a new `ERR_IMPORT_ATTRIBUTE_UNSUPPORTED` error. | ||
* | ||
* @see {@linkcode ErrImportAttributeUnsupported} | ||
* | ||
* @param {string} key | ||
* Import attribute key | ||
* @param {string} value | ||
* Import attribute value | ||
* @return {ErrImportAttributeUnsupported} | ||
*/ | ||
new (key: string, value: string): ErrImportAttributeUnsupported | ||
} | ||
|
||
/** | ||
* `ERR_IMPORT_ATTRIBUTE_UNSUPPORTED` model. | ||
* | ||
* Thrown when an import attribute is not supported by a version of Node.js. | ||
* | ||
* @see {@linkcode ErrImportAttributeUnsupportedConstructor} | ||
* | ||
* @type {ErrImportAttributeUnsupportedConstructor} | ||
* | ||
* @class | ||
*/ | ||
const ERR_IMPORT_ATTRIBUTE_UNSUPPORTED: | ||
ErrImportAttributeUnsupportedConstructor = E( | ||
codes.ERR_IMPORT_ATTRIBUTE_UNSUPPORTED, | ||
TypeError, | ||
'Import attribute "%s" with value "%s" is not supported' | ||
) | ||
|
||
export { | ||
ERR_IMPORT_ATTRIBUTE_UNSUPPORTED as default, | ||
type ErrImportAttributeUnsupported, | ||
type Args as ErrImportAttributeUnsupportedArgs, | ||
type ErrImportAttributeUnsupportedConstructor | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters