Skip to content

Commit 9bfb941

Browse files
feature(@nestjs/common) HttpException extends Error
1 parent e8a72e6 commit 9bfb941

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/common/exceptions/http.exception.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
export class HttpException {
2-
private readonly message: string | object;
1+
export class HttpException extends Error {
2+
public readonly message: any;
33

44
/**
55
* The base Nest Application exception, which is handled by the default Exceptions Handler.
6-
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
6+
* If you throw an exception from your HTTP route handler, Nest will map them to the appropriate HTTP response and send to the client.
77
*
88
* When `response` is an object:
99
* - object will be stringified and returned to the user as a JSON response,
@@ -19,6 +19,7 @@ export class HttpException {
1919
private readonly response: string | object,
2020
private readonly status: number,
2121
) {
22+
super();
2223
this.message = response;
2324
}
2425

0 commit comments

Comments
 (0)