@raevon/n8n-nodes-whatsapp 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,18 +52,32 @@ class WhatsAppConnect {
52
52
  for (let i = 0; i < items.length; i++) {
53
53
  try {
54
54
  if (operation === 'connect') {
55
- // Start the background WhatsApp server
56
- await (0, WhatsAppApiHelper_1.ensureServerRunning)(cfg);
55
+ // Start the WhatsApp server
56
+ try {
57
+ await (0, WhatsAppApiHelper_1.ensureServerRunning)(cfg);
58
+ }
59
+ catch (serverErr) {
60
+ returnData.push({
61
+ json: { connected: false, error: `Server start failed: ${serverErr.message}`, sessionPath: cfg.sessionPath },
62
+ pairedItem: { item: i },
63
+ });
64
+ continue;
65
+ }
57
66
  // Connect to the server
58
- const response = await fetch(`${(0, WhatsAppApiHelper_1.getServerUrl)(cfg)}/connect`, { method: 'POST' });
59
- const result = await response.json();
60
- returnData.push({
61
- json: {
62
- ...result,
63
- sessionPath: cfg.sessionPath,
64
- },
65
- pairedItem: { item: i },
66
- });
67
+ try {
68
+ const response = await fetch(`${(0, WhatsAppApiHelper_1.getServerUrl)(cfg)}/connect`, { method: 'POST' });
69
+ const result = await response.json();
70
+ returnData.push({
71
+ json: { ...result, sessionPath: cfg.sessionPath },
72
+ pairedItem: { item: i },
73
+ });
74
+ }
75
+ catch (fetchErr) {
76
+ returnData.push({
77
+ json: { connected: false, error: `Fetch failed: ${fetchErr.message}. Server URL: ${(0, WhatsAppApiHelper_1.getServerUrl)(cfg)}`, sessionPath: cfg.sessionPath },
78
+ pairedItem: { item: i },
79
+ });
80
+ }
67
81
  }
68
82
  else if (operation === 'status') {
69
83
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raevon/n8n-nodes-whatsapp",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "n8n community node for WhatsApp — send and receive messages with anti-ban protection via the Baileys library",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",