Fix files not returning busboy error

This commit is contained in:
rijkvanzanten
2020-09-08 14:56:48 -04:00
parent 74eddbc310
commit ffe3cc0fea

View File

@@ -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) => {