Skip to content

Commit

Permalink
fix(WrapperError): checking for the existence of a method
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZillaGold committed May 2, 2021
1 parent adba6f0 commit 5bc8148
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "namemcwrapper",
"version": "2.0.3",
"version": "2.0.4",
"description": "ES6 Promise based wrapper for NameMC.com",
"main": "./dist/NameMC.js",
"exports": {
Expand Down
6 changes: 5 additions & 1 deletion src/WrapperError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export class WrapperError extends Error {
this.code = code;
this.name = this.constructor.name;

Error.captureStackTrace(this, this.constructor);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = (new Error()).stack;
}
}

get [Symbol.toStringTag](): string {
Expand Down

0 comments on commit 5bc8148

Please sign in to comment.