Skip to content

Commit

Permalink
Added builder method withData to exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Wassenhoven committed Sep 11, 2023
1 parent 0389e3a commit 4f72366
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Code/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grexcept",
"version": "2.0.8",
"version": "2.1.0",
"description": "Common exception classes for browser and NodeJS",
"repository": "https://github.com/wassy92x/grexcept",
"keywords": [
Expand Down
5 changes: 5 additions & 0 deletions Code/src/Exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ export class Exception extends Error {
}
}

public withData(description: string, data: any): this {
this.data.add(description, data);
return this;
}

protected _buildStacktrace(json = false): string {
let dataEntries = this.data.toString(json);
if (dataEntries)
Expand Down

0 comments on commit 4f72366

Please sign in to comment.