mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 15:08:37 +00:00
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:
@@ -33,6 +33,7 @@ describe('GraphQL Pipes', () => {
|
||||
code: 'INTERNAL_SERVER_ERROR',
|
||||
exception: {
|
||||
message: 'Bad Request Exception',
|
||||
name: 'BadRequestException',
|
||||
response: {
|
||||
message: [
|
||||
'description must be longer than or equal to 30 characters',
|
||||
|
||||
@@ -40,7 +40,7 @@ export class HttpException extends Error {
|
||||
) {
|
||||
super();
|
||||
this.initMessage();
|
||||
this.setName();
|
||||
this.initName();
|
||||
}
|
||||
|
||||
public initMessage() {
|
||||
@@ -79,7 +79,7 @@ export class HttpException extends Error {
|
||||
: { statusCode, message: objectOrError, error: description };
|
||||
}
|
||||
|
||||
public setName(): void {
|
||||
public initName(): void {
|
||||
this.name = this.constructor.name;
|
||||
}
|
||||
}
|
||||
|
||||
0
scripts/run-integration.sh
Normal file → Executable file
0
scripts/run-integration.sh
Normal file → Executable file
Reference in New Issue
Block a user