mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +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',
|
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',
|
||||||
|
|||||||
@@ -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
0
scripts/run-integration.sh
Normal file → Executable file
Reference in New Issue
Block a user