From 74771d92cfc605f098e35455cb7c68573840f451 Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Thu, 26 Jan 2023 09:23:10 +0000 Subject: [PATCH] Formidable: Now return 400 BadRequest HttpError instead of generic error. --- flaska.mjs | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flaska.mjs b/flaska.mjs index 98d361b..88002ac 100644 --- a/flaska.mjs +++ b/flaska.mjs @@ -237,7 +237,7 @@ export function FormidableHandler(formidable, org = {}) { return new Promise(function(res, rej) { form.parse(ctx.req, function(err, fields, files) { - if (err) return rej(err) + if (err) return rej(new HttpError(400, err.message)) if (opts.parseFields) { Object.keys(fields).forEach(function(key) { diff --git a/package.json b/package.json index 10e26e3..54c6c1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flaska", - "version": "1.3.1", + "version": "1.3.2", "description": "Flaska is a micro web-framework for node. It is designed to be fast, simple and lightweight, and is distributed as a single file module with no dependencies.", "main": "flaska.mjs", "scripts": {