Skip to content

Commit

Permalink
Add public cause attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnymac committed Jun 1, 2022
1 parent 32d1e96 commit 727b239
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/common/exceptions/http.exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export class HttpException extends Error {
this.initCause();
}

public cause: Error | undefined;

/**
* Configures error chaining support
*
Expand All @@ -53,7 +55,6 @@ export class HttpException extends Error {
*/
public initCause() {
if (this.response instanceof Error) {
// @ts-ignore
this.cause = this.response;
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/common/test/exceptions/http.exception.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ describe('HttpException', () => {
const message = new Error('Some Error');
const error = new HttpException(message, 400);
expect(`${error}`).to.be.eql(`HttpException: ${message.message}`);
// @ts-ignore
const { cause } = error;

expect(cause).to.be.eql(message);
Expand Down

0 comments on commit 727b239

Please sign in to comment.