Skip to content

Commit

Permalink
fix: throw an invalid exception object
Browse files Browse the repository at this point in the history
  • Loading branch information
eltfshr authored and riflowth committed May 14, 2022
1 parent 068cd27 commit 5a4851f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/decorators/RequestDecorator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const BadRequestException = require('../exceptions/BadRequestException');

const RequestBody = (...keys) => {
return (target, propertyKey, descriptor) => {
const method = target[propertyKey];
Expand All @@ -17,7 +19,7 @@ const RequestBody = (...keys) => {
}

const firstMissingKey = keys.find((key) => !request.body[key]);
throw new InvalidRequestException(`${firstMissingKey} does not specified in request body`);
throw new BadRequestException(`${firstMissingKey} does not specified in request body`);
}
};
};
Expand Down

0 comments on commit 5a4851f

Please sign in to comment.