diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-07-23 20:12:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-24 03:12:08 +0000 |
commit | 29934d558c188fdc3406706da19921ca5a389383 (patch) | |
tree | e8fb644f7f90df9ceb32c9bdbba9367aaad833c2 /ext/node/polyfills/internal/errors.ts | |
parent | 52ababc4bf948904092cff54c2ab8b91f6b9b443 (diff) |
fix(node): Run node compat tests listed in the `ignore` field (and fix the ones that fail) (#24631)
The intent is that those tests will be executed, but our check that the
files are up to date won't overwrite the contents of the tests. This is
useful when a test needs some manual edits to work.
It turns out we weren't actually running them.
---
This ended up turning into a couple of small bug fixes to get the tests
passing:
- We weren't canonicalizing the exec path properly (it sometimes still
had `..` or `.` in it)
- We weren't accepting strings in `process.exit`
There was one failure I couldn't figure out quickly, so I disabled the
test for now, and filed a follow up issue: #24694
Diffstat (limited to 'ext/node/polyfills/internal/errors.ts')
-rw-r--r-- | ext/node/polyfills/internal/errors.ts | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/ext/node/polyfills/internal/errors.ts b/ext/node/polyfills/internal/errors.ts index 6529e9894..9ec9f9949 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 } = primordials; +const { JSONStringify, SymbolFor } = primordials; import { format, inspect } from "ext:deno_node/internal/util/inspect.mjs"; import { codes } from "ext:deno_node/internal/error_codes.ts"; import { @@ -421,8 +421,11 @@ export interface NodeSystemErrorCtx { // `err.info`. // The context passed into this error must have .code, .syscall and .message, // and may have .path and .dest. -class NodeSystemError extends NodeErrorAbstraction { +class NodeSystemError extends Error { + code: string; constructor(key: string, context: NodeSystemErrorCtx, msgPrefix: string) { + super(); + this.code = key; let message = `${msgPrefix}: ${context.syscall} returned ` + `${context.code} (${context.message})`; @@ -433,8 +436,6 @@ class NodeSystemError extends NodeErrorAbstraction { message += ` => ${context.dest}`; } - super("SystemError", key, message); - captureLargerStackTrace(this); Object.defineProperties(this, { @@ -444,6 +445,18 @@ class NodeSystemError extends NodeErrorAbstraction { writable: false, configurable: true, }, + name: { + value: "SystemError", + enumerable: false, + writable: true, + configurable: true, + }, + message: { + value: message, + enumerable: false, + writable: true, + configurable: true, + }, info: { value: context, enumerable: true, @@ -502,6 +515,15 @@ class NodeSystemError extends NodeErrorAbstraction { override toString() { return `${this.name} [${this.code}]: ${this.message}`; } + + // deno-lint-ignore no-explicit-any + [SymbolFor("nodejs.util.inspect.custom")](_recurseTimes: number, ctx: any) { + return inspect(this, { + ...ctx, + getters: true, + customInspect: false, + }); + } } function makeSystemErrorWithCode(key: string, msgPrfix: string) { |