fix(common): set name of httpexception as class name

Added a method to set name property of exception object equal to class name which currently is always Error. Updated tests.

Closes #5809
This commit is contained in:
Karan Gupta
2020-12-04 14:18:28 +05:30
parent 66b1a6a420
commit e54c0e1c79
3 changed files with 3 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ describe('GraphQL Pipes', () => {
code: 'INTERNAL_SERVER_ERROR', code: 'INTERNAL_SERVER_ERROR',
exception: { exception: {
message: 'Bad Request Exception', message: 'Bad Request Exception',
name: 'BadRequestException',
response: { response: {
message: [ message: [
'description must be longer than or equal to 30 characters', 'description must be longer than or equal to 30 characters',

View File

@@ -40,7 +40,7 @@ export class HttpException extends Error {
) { ) {
super(); super();
this.initMessage(); this.initMessage();
this.setName(); this.initName();
} }
public initMessage() { public initMessage() {
@@ -79,7 +79,7 @@ export class HttpException extends Error {
: { statusCode, message: objectOrError, error: description }; : { statusCode, message: objectOrError, error: description };
} }
public setName(): void { public initName(): void {
this.name = this.constructor.name; this.name = this.constructor.name;
} }
} }

0
scripts/run-integration.sh Normal file → Executable file
View File