From eadccec075550b00e2b747ed90f0ce76abb30533 Mon Sep 17 00:00:00 2001 From: FlameWolf Date: Mon, 18 Nov 2024 14:28:18 +0530 Subject: [PATCH] Fix file size limit error handling --- index.js | 11 +++++------ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index f2a6d78..78cf7a6 100644 --- a/index.js +++ b/index.js @@ -25,12 +25,11 @@ const formDataParser = async (instance, options) => { }); bus.on("file", (name, stream, info) => { stream.on("limit", () => { - done( - new Error("File size limit exceeded", { - field: name, - ...info - }) - ); + done({ + message: "File size limit exceeded", + field: name, + ...info + }); }); try { results.push(storage.process(name, stream, info)); diff --git a/package-lock.json b/package-lock.json index 991799c..8fb40cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "formzilla", - "version": "3.5.0", + "version": "3.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "formzilla", - "version": "3.5.0", + "version": "3.5.1", "license": "ISC", "dependencies": { "busboy": "^1.6.0" diff --git a/package.json b/package.json index f534cee..2a5d348 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "formzilla", - "version": "3.5.0", + "version": "3.5.1", "description": "Fastify plugin for parsing multipart/form data", "main": "index.js", "scripts": {