summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/errors.ts
diff options
context:
space:
mode:
authorhaturau <135221985+haturatu@users.noreply.github.com>2024-11-20 01:20:47 +0900
committerGitHub <noreply@github.com>2024-11-20 01:20:47 +0900
commit85719a67e59c7aa45bead26e4942d7df8b1b42d4 (patch)
treeface0aecaac53e93ce2f23b53c48859bcf1a36ec /ext/node/polyfills/internal/errors.ts
parent67697bc2e4a62a9670699fd18ad0dd8efc5bd955 (diff)
parent186b52731c6bb326c4d32905c5e732d082e83465 (diff)
Merge branch 'denoland:main' into main
Diffstat (limited to 'ext/node/polyfills/internal/errors.ts')
-rw-r--r--ext/node/polyfills/internal/errors.ts49
1 files changed, 35 insertions, 14 deletions
diff --git a/ext/node/polyfills/internal/errors.ts b/ext/node/polyfills/internal/errors.ts
index 51bd7a025..61b53fa96 100644
--- a/ext/node/polyfills/internal/errors.ts
+++ b/ext/node/polyfills/internal/errors.ts
@@ -18,7 +18,7 @@
*/
import { primordials } from "ext:core/mod.js";
-const { JSONStringify, SymbolFor } = primordials;
+const { JSONStringify, SafeArrayIterator, SymbolFor } = primordials;
import { format, inspect } from "ext:deno_node/internal/util/inspect.mjs";
import { codes } from "ext:deno_node/internal/error_codes.ts";
import {
@@ -1874,6 +1874,11 @@ export class ERR_SOCKET_CLOSED extends NodeError {
super("ERR_SOCKET_CLOSED", `Socket is closed`);
}
}
+export class ERR_SOCKET_CONNECTION_TIMEOUT extends NodeError {
+ constructor() {
+ super("ERR_SOCKET_CONNECTION_TIMEOUT", `Socket connection timeout`);
+ }
+}
export class ERR_SOCKET_DGRAM_IS_CONNECTED extends NodeError {
constructor() {
super("ERR_SOCKET_DGRAM_IS_CONNECTED", `Already connected`);
@@ -2385,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) {
@@ -2558,19 +2572,6 @@ export class ERR_FS_RMDIR_ENOTDIR extends NodeSystemError {
}
}
-export class ERR_OS_NO_HOMEDIR extends NodeSystemError {
- constructor() {
- const code = isWindows ? "ENOENT" : "ENOTDIR";
- const ctx: NodeSystemErrorCtx = {
- message: "not a directory",
- syscall: "home",
- code,
- errno: isWindows ? osConstants.errno.ENOENT : osConstants.errno.ENOTDIR,
- };
- super(code, ctx, "Path is not a directory");
- }
-}
-
export class ERR_HTTP_SOCKET_ASSIGNED extends NodeError {
constructor() {
super(
@@ -2646,11 +2647,30 @@ export function aggregateTwoErrors(
}
return innerError || outerError;
}
+
+export class NodeAggregateError extends AggregateError {
+ code: string;
+ constructor(errors, message) {
+ super(new SafeArrayIterator(errors), message);
+ this.code = errors[0]?.code;
+ }
+
+ get [kIsNodeError]() {
+ return true;
+ }
+
+ // deno-lint-ignore adjacent-overload-signatures
+ get ["constructor"]() {
+ return AggregateError;
+ }
+}
+
codes.ERR_IPC_CHANNEL_CLOSED = ERR_IPC_CHANNEL_CLOSED;
codes.ERR_INVALID_ARG_TYPE = ERR_INVALID_ARG_TYPE;
codes.ERR_INVALID_ARG_VALUE = ERR_INVALID_ARG_VALUE;
codes.ERR_OUT_OF_RANGE = ERR_OUT_OF_RANGE;
codes.ERR_SOCKET_BAD_PORT = ERR_SOCKET_BAD_PORT;
+codes.ERR_SOCKET_CONNECTION_TIMEOUT = ERR_SOCKET_CONNECTION_TIMEOUT;
codes.ERR_BUFFER_OUT_OF_BOUNDS = ERR_BUFFER_OUT_OF_BOUNDS;
codes.ERR_UNKNOWN_ENCODING = ERR_UNKNOWN_ENCODING;
codes.ERR_PARSE_ARGS_INVALID_OPTION_VALUE = ERR_PARSE_ARGS_INVALID_OPTION_VALUE;
@@ -2851,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,