From ffe3cc0feab66dfd71edae5ded45c7de0e393010 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Tue, 8 Sep 2020 14:56:48 -0400 Subject: [PATCH] Fix files not returning busboy error --- api/src/controllers/files.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/src/controllers/files.ts b/api/src/controllers/files.ts index a7acc7ddab..f9a7105332 100644 --- a/api/src/controllers/files.ts +++ b/api/src/controllers/files.ts @@ -67,9 +67,13 @@ const multipartHandler = asyncHandler(async (req, res, next) => { storage: payload.storage || disk, }; - const primaryKey = await service.upload(fileStream, payloadWithRequiredFields, existingPrimaryKey); - savedFiles.push(primaryKey); - tryDone(); + try { + const primaryKey = await service.upload(fileStream, payloadWithRequiredFields, existingPrimaryKey); + savedFiles.push(primaryKey); + tryDone(); + } catch (error) { + busboy.emit('error', error); + } }); busboy.on('error', (error: Error) => {