Class: LoggerExceptionFilter
The Logger Exception Filter Class
Out of the box, this action is performed by a built-in global exception filter, which handles exceptions of type HttpException
Extends
BaseExceptionFilter
Constructors
new LoggerExceptionFilter()
new LoggerExceptionFilter(
loggerService):LoggerExceptionFilter
Constructor
Parameters
| Parameter | Type | Description |
|---|---|---|
loggerService | LoggerService | instance of the Logger Service |
Returns
Overrides
BaseExceptionFilter.constructor
Defined in
packages/nestjs-logger/src/logger-exception.filter.ts:21 (opens in a new tab)
Properties
| Property | Modifier | Type | Inherited from |
|---|---|---|---|
applicationRef? | readonly | HttpServer<any, any> | BaseExceptionFilter.applicationRef |
httpAdapterHost? | readonly | HttpAdapterHost<AbstractHttpAdapter<any, any, any>> | BaseExceptionFilter.httpAdapterHost |
Methods
catch()
catch(
exception,host):void
Override catch to log before returning exception.
Parameters
| Parameter | Type | Description |
|---|---|---|
exception | Error | Error instance |
host | ArgumentsHost | Arguments Host instance |
Returns
void
Overrides
BaseExceptionFilter.catch
Defined in
packages/nestjs-logger/src/logger-exception.filter.ts:34 (opens in a new tab)
handleUnknownError()
handleUnknownError(
exception,host,applicationRef):void
Parameters
| Parameter | Type |
|---|---|
exception | any |
host | ArgumentsHost |
applicationRef | HttpServer<any, any> | AbstractHttpAdapter<any, any, any> |
Returns
void
Inherited from
BaseExceptionFilter.handleUnknownError
Defined in
node_modules/@nestjs/core/exceptions/base-exception-filter.d.ts:10
isExceptionObject()
isExceptionObject(
err):err is Error
Parameters
| Parameter | Type |
|---|---|
err | any |
Returns
err is Error
Inherited from
BaseExceptionFilter.isExceptionObject
Defined in
node_modules/@nestjs/core/exceptions/base-exception-filter.d.ts:11
isHttpError()
isHttpError(
err):err is Object
Checks if the thrown error comes from the "http-errors" library.
Parameters
| Parameter | Type | Description |
|---|---|---|
err | any | error object |
Returns
err is Object
Inherited from
BaseExceptionFilter.isHttpError
Defined in
node_modules/@nestjs/core/exceptions/base-exception-filter.d.ts:16