Skip to content

Commit

Permalink
fixup: emit error on key missing instead of next
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Toozs committed Jul 9, 2024
1 parent 7033c44 commit b4f878d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ const api = {
if ('key' in request.formData) {
return next(null);
}
return next(errors.InvalidArgument.customizeDescription('Bucket POST must contain'
+ " a field named 'key'. If it is specified, please check the order of the fields."));

const err = errors.InvalidArgument.customizeDescription('Bucket POST must contain'
+ " a field named 'key'. If it is specified, please check the order of the fields.");
formDataParser.emit('error', err);
});
formDataParser.on('finish', () => {
// No file field == error
Expand Down

0 comments on commit b4f878d

Please sign in to comment.