File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { isString } from '../utils/shared.utils' ;
2+
13export class HttpException extends Error {
24 public readonly message : any ;
35
@@ -31,17 +33,12 @@ export class HttpException extends Error {
3133 return this . status ;
3234 }
3335
34- private getErrorString ( target : string | object ) : string {
35- if ( typeof target === 'string' ) {
36- return target ;
37- }
38-
39- return JSON . stringify ( target ) ;
40- }
41-
4236 public toString ( ) : string {
4337 const message = this . getErrorString ( this . message ) ;
44-
4538 return `Error: ${ message } ` ;
4639 }
40+
41+ private getErrorString ( target : string | object ) : string {
42+ return isString ( target ) ? target : JSON . stringify ( target ) ;
43+ }
4744}
Original file line number Diff line number Diff line change @@ -8,15 +8,19 @@ import {
88import { InstanceWrapper } from './injector/instance-wrapper' ;
99
1010export class ApplicationConfig {
11+ private globalPrefix = '' ;
1112 private globalPipes : PipeTransform [ ] = [ ] ;
12- private globalRequestPipes : InstanceWrapper < PipeTransform > [ ] = [ ] ;
1313 private globalFilters : ExceptionFilter [ ] = [ ] ;
14- private globalRequestFilters : InstanceWrapper < ExceptionFilter > [ ] = [ ] ;
1514 private globalInterceptors : NestInterceptor [ ] = [ ] ;
16- private globalRequestInterceptors : InstanceWrapper < NestInterceptor > [ ] = [ ] ;
1715 private globalGuards : CanActivate [ ] = [ ] ;
18- private globalRequestGuards : InstanceWrapper < CanActivate > [ ] = [ ] ;
19- private globalPrefix = '' ;
16+ private readonly globalRequestPipes : InstanceWrapper < PipeTransform > [ ] = [ ] ;
17+ private readonly globalRequestFilters : InstanceWrapper <
18+ ExceptionFilter
19+ > [ ] = [ ] ;
20+ private readonly globalRequestInterceptors : InstanceWrapper <
21+ NestInterceptor
22+ > [ ] = [ ] ;
23+ private readonly globalRequestGuards : InstanceWrapper < CanActivate > [ ] = [ ] ;
2024
2125 constructor ( private ioAdapter : WebSocketAdapter | null = null ) { }
2226
Original file line number Diff line number Diff line change 1+ import { isString } from '@nestjs/common/utils/shared.utils' ;
2+
13export class RpcException extends Error {
24 public readonly message : any ;
35 constructor ( private readonly error : string | object ) {
@@ -9,17 +11,12 @@ export class RpcException extends Error {
911 return this . error ;
1012 }
1113
12- private getErrorString ( target : string | object ) : string {
13- if ( typeof target === 'string' ) {
14- return target ;
15- }
16-
17- return JSON . stringify ( target ) ;
18- }
19-
2014 public toString ( ) : string {
2115 const message = this . getErrorString ( this . message ) ;
22-
2316 return `Error: ${ message } ` ;
2417 }
18+
19+ private getErrorString ( target : string | object ) : string {
20+ return isString ( target ) ? target : JSON . stringify ( target ) ;
21+ }
2522}
Original file line number Diff line number Diff line change 1+ import { isString } from '@nestjs/common/utils/shared.utils' ;
2+
13export class WsException extends Error {
24 public readonly message : any ;
35
@@ -10,17 +12,12 @@ export class WsException extends Error {
1012 return this . error ;
1113 }
1214
13- private getErrorString ( target : string | object ) : string {
14- if ( typeof target === 'string' ) {
15- return target ;
16- }
17-
18- return JSON . stringify ( target ) ;
19- }
20-
2115 public toString ( ) : string {
2216 const message = this . getErrorString ( this . message ) ;
23-
2417 return `Error: ${ message } ` ;
2518 }
19+
20+ private getErrorString ( target : string | object ) : string {
21+ return isString ( target ) ? target : JSON . stringify ( target ) ;
22+ }
2623}
You can’t perform that action at this time.
0 commit comments