From 5a4851ff5df449e641077cb37a47c74c10339adf Mon Sep 17 00:00:00 2001 From: Nathee Jaywaree <73115539+eltfshr@users.noreply.github.com> Date: Sat, 14 May 2022 17:02:04 +0700 Subject: [PATCH] fix: throw an invalid exception object --- lib/decorators/RequestDecorator.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/decorators/RequestDecorator.js b/lib/decorators/RequestDecorator.js index 5daadc3..b275d77 100644 --- a/lib/decorators/RequestDecorator.js +++ b/lib/decorators/RequestDecorator.js @@ -1,5 +1,7 @@ 'use strict'; +const BadRequestException = require('../exceptions/BadRequestException'); + const RequestBody = (...keys) => { return (target, propertyKey, descriptor) => { const method = target[propertyKey]; @@ -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`); } }; };