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 Closes #5809
This commit is contained in:
@@ -40,6 +40,7 @@ export class HttpException extends Error {
|
||||
) {
|
||||
super();
|
||||
this.initMessage();
|
||||
this.setName();
|
||||
}
|
||||
|
||||
public initMessage() {
|
||||
@@ -77,5 +78,8 @@ export class HttpException extends Error {
|
||||
? objectOrError
|
||||
: { statusCode, message: objectOrError, error: description };
|
||||
}
|
||||
}
|
||||
|
||||
public setName(): void {
|
||||
this.name = this.constructor.name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user