Skip to content

Commit 39061ca

Browse files
authored
Merge pull request #11 from mimamch/dev-fixWhatsappErrorClass
fix: WhatsappError class intanceof return false
2 parents 18ee3f9 + 317b0d2 commit 39061ca

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wa-multi-session",
3-
"version": "3.2.0",
3+
"version": "3.2.1",
44
"description": "Multi Session Whatsapp Library",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ whatsapp.setCredentialsDir("my_custom_dir");
211211

212212
## Change Log
213213

214-
v3.2.0 July 2023 (LATEST)
214+
v3.2.1 July 2023 (LATEST)
215215

216216
- Add error class named: WhatsappError
217217

src/Error/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
export class WhatsappError extends Error {
22
constructor(message: string) {
33
super(message);
4+
this.name = "WhatsappError";
5+
Object.setPrototypeOf(this, WhatsappError.prototype);
6+
}
7+
8+
static isWhatsappError(error: any): error is WhatsappError {
9+
return error instanceof WhatsappError || error instanceof Error;
410
}
511
}

0 commit comments

Comments
 (0)