summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-11-13 19:47:01 +0530
committerGitHub <noreply@github.com>2024-11-13 19:47:01 +0530
commit7d9ba09f5a4464072476b8992e43f5e5c30bde3a (patch)
treef101692fb4ab1efbb291556e3eb764797249387c /ext
parent9331e2cef044945a91d53ea4cdc829d304157e0d (diff)
fix(ext/node): use ERR_NOT_IMPLEMENTED for notImplemented (#26853)
Diffstat (limited to 'ext')
-rw-r--r--ext/node/polyfills/_utils.ts4
-rw-r--r--ext/node/polyfills/internal/errors.ts10
2 files changed, 12 insertions, 2 deletions
diff --git a/ext/node/polyfills/_utils.ts b/ext/node/polyfills/_utils.ts
index b50c113e1..79d84e00f 100644
--- a/ext/node/polyfills/_utils.ts
+++ b/ext/node/polyfills/_utils.ts
@@ -17,6 +17,7 @@ const {
import { TextDecoder, TextEncoder } from "ext:deno_web/08_text_encoding.js";
import { errorMap } from "ext:deno_node/internal_binding/uv.ts";
import { codes } from "ext:deno_node/internal/error_codes.ts";
+import { ERR_NOT_IMPLEMENTED } from "ext:deno_node/internal/errors.ts";
export type BinaryEncodings = "binary";
@@ -34,8 +35,7 @@ export type TextEncodings =
export type Encodings = BinaryEncodings | TextEncodings;
export function notImplemented(msg: string): never {
- const message = msg ? `Not implemented: ${msg}` : "Not implemented";
- throw new Error(message);
+ throw new ERR_NOT_IMPLEMENTED(msg);
}
export function warnNotImplemented(msg?: string) {
diff --git a/ext/node/polyfills/internal/errors.ts b/ext/node/polyfills/internal/errors.ts
index 962ca86e9..61b53fa96 100644
--- a/ext/node/polyfills/internal/errors.ts
+++ b/ext/node/polyfills/internal/errors.ts
@@ -2390,6 +2390,15 @@ export class ERR_INVALID_RETURN_VALUE extends NodeTypeError {
}
}
+export class ERR_NOT_IMPLEMENTED extends NodeError {
+ constructor(message?: string) {
+ super(
+ "ERR_NOT_IMPLEMENTED",
+ message ? `Not implemented: ${message}` : "Not implemented",
+ );
+ }
+}
+
export class ERR_INVALID_URL extends NodeTypeError {
input: string;
constructor(input: string) {
@@ -2862,6 +2871,7 @@ export default {
ERR_INVALID_SYNC_FORK_INPUT,
ERR_INVALID_THIS,
ERR_INVALID_TUPLE,
+ ERR_NOT_IMPLEMENTED,
ERR_INVALID_URI,
ERR_INVALID_URL,
ERR_INVALID_URL_SCHEME,