fix(ext/node): assign 'ERR_BUFFER_TOO_LARGE' to codes (#30311)
Some checks are pending
ci / build libs (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions

Closes https://github.com/denoland/deno/issues/30310
This commit is contained in:
Bartek Iwańczuk 2025-08-04 18:19:46 +02:00 committed by GitHub
parent 45f64df6c1
commit efb5617d15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -2742,6 +2742,7 @@ export class NodeAggregateError extends AggregateError {
}
}
codes.ERR_BUFFER_TOO_LARGE = ERR_BUFFER_TOO_LARGE;
codes.ERR_IPC_CHANNEL_CLOSED = ERR_IPC_CHANNEL_CLOSED;
codes.ERR_METHOD_NOT_IMPLEMENTED = ERR_METHOD_NOT_IMPLEMENTED;
codes.ERR_INVALID_RETURN_VALUE = ERR_INVALID_RETURN_VALUE;

View file

@ -2,6 +2,7 @@
import { assert, assertEquals, assertThrows } from "@std/assert";
import { fromFileUrl, relative } from "@std/path";
import { randomBytes } from "node:crypto";
import {
BrotliCompress,
brotliCompress,
@ -14,6 +15,7 @@ import {
createBrotliCompress,
createBrotliDecompress,
createDeflate,
deflateSync,
gzip,
gzipSync,
unzipSync,
@ -273,3 +275,14 @@ Deno.test("BrotliCompress", async () => {
await deffered.promise;
assertEquals(data, "hello");
});
Deno.test("ERR_BUFFER_TOO_LARGE works correctly", () => {
assertThrows(
() => {
deflateSync(randomBytes(1024), {
maxOutputLength: 1,
});
},
"Cannot create a Buffer larger than 1 bytes",
);
});