Skip to content

Commit e54c0e1

Browse files
committed
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 nestjs#5809
1 parent 66b1a6a commit e54c0e1

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

integration/graphql-code-first/e2e/pipes.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ describe('GraphQL Pipes', () => {
3333
code: 'INTERNAL_SERVER_ERROR',
3434
exception: {
3535
message: 'Bad Request Exception',
36+
name: 'BadRequestException',
3637
response: {
3738
message: [
3839
'description must be longer than or equal to 30 characters',

packages/common/exceptions/http.exception.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class HttpException extends Error {
4040
) {
4141
super();
4242
this.initMessage();
43-
this.setName();
43+
this.initName();
4444
}
4545

4646
public initMessage() {
@@ -79,7 +79,7 @@ export class HttpException extends Error {
7979
: { statusCode, message: objectOrError, error: description };
8080
}
8181

82-
public setName(): void {
82+
public initName(): void {
8383
this.name = this.constructor.name;
8484
}
8585
}

scripts/run-integration.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)