Request Exception
message:StringstatusCodeOptional:Number)#
GenericRequestException(:String
statusCodeOptional:Number
Returns a Generic HTTP Exception to the client.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
message | No | String | Server | Error Message | ||
statusCode | Yes | Number | 500 | HTTP 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); } }}
messageOptional:String)#
BadRequestException(:String
Returns a bad request HTTP Exception Response to the Client.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
message | Yes | String | Bad Request | Error Mesage |
#
Example@Router('/')class ExceptionExampleController { @Get('/exception') exceptionMethod(req, res, next) { throw new BadRequestException(); }}
messageOptional:String)#
UnauthorizedException(:String
Returns an unauthorized HTTP Exception Response to the Client.
Parameters
Name | Optional | Type | Defaults | Description | ||
---|---|---|---|---|---|---|
message | Yes | String | Unauthorized Request | Error Mesage |
#
Example@Router('/')class ExceptionExampleController { @Get('/exception') exceptionMethod(req, res, next) { throw new UnauthorizedException(); }}