Skip to main content

Request Exception

GenericRequestException(
message
:String
statusCodeOptional
:Number
)#

Returns a Generic HTTP Exception to the client.

Parameters
NameOptionalTypeDefaultsDescription
messageNoStringServerError Message
statusCodeYesNumber500HTTP Status Code

Example#

@Router('/')class ExceptionExampleController {  @Get('/exception')  exceptionMethod(req, res, next) {    try {      throw new GenericRequestException('Page not found', 404);    } catch (e) {      res.status(e.code).send(e.message);    }  }}

BadRequestException(
messageOptional
:String
)#

Returns a bad request HTTP Exception Response to the Client.

Parameters
NameOptionalTypeDefaultsDescription
messageYesStringBad RequestError Mesage

Example#

@Router('/')class ExceptionExampleController {    @Get('/exception')    exceptionMethod(req, res, next) {        throw new BadRequestException();    }}

UnauthorizedException(
messageOptional
:String
)#

Returns an unauthorized HTTP Exception Response to the Client.

Parameters
NameOptionalTypeDefaultsDescription
messageYesStringUnauthorized RequestError Mesage

Example#

@Router('/')class ExceptionExampleController {    @Get('/exception')    exceptionMethod(req, res, next) {        throw new UnauthorizedException();    }}