mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix(ext/node): implement uv.errname (#20785)
Fixes https://github.com/denoland/deno/issues/20617
This commit is contained in:
parent
0fb5d2e60c
commit
e377c172e3
2 changed files with 21 additions and 0 deletions
|
@ -786,3 +786,16 @@ Deno.test({
|
||||||
worker.terminate();
|
worker.terminate();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test({
|
||||||
|
name: "process.binding('uv').errname",
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
fn() {
|
||||||
|
// @ts-ignore: untyped internal binding, not actually supposed to be
|
||||||
|
// used by userland modules in Node.js
|
||||||
|
const uv = process.binding("uv");
|
||||||
|
assert(uv.errname);
|
||||||
|
assert(typeof uv.errname === "function");
|
||||||
|
assertEquals(uv.errname(-1), "EPERM");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
|
@ -531,3 +531,11 @@ export const UV_EINVAL = codeMap.get("EINVAL")!;
|
||||||
export const UV_ENOENT = codeMap.get("ENOENT");
|
export const UV_ENOENT = codeMap.get("ENOENT");
|
||||||
export const UV_ENOTSOCK = codeMap.get("ENOTSOCK")!;
|
export const UV_ENOTSOCK = codeMap.get("ENOTSOCK")!;
|
||||||
export const UV_UNKNOWN = codeMap.get("UNKNOWN")!;
|
export const UV_UNKNOWN = codeMap.get("UNKNOWN")!;
|
||||||
|
|
||||||
|
export function errname(errno: number): string {
|
||||||
|
const err = errorMap.get(errno);
|
||||||
|
if (err) {
|
||||||
|
return err[0];
|
||||||
|
}
|
||||||
|
return `UNKNOWN (${errno})`;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue