diff --git a/packages/plugin-whatsapp/src/handlers/webhook.handler.ts b/packages/plugin-whatsapp/src/handlers/webhook.handler.ts index 94c89e9bf5..cf7dc73ae1 100644 --- a/packages/plugin-whatsapp/src/handlers/webhook.handler.ts +++ b/packages/plugin-whatsapp/src/handlers/webhook.handler.ts @@ -21,8 +21,13 @@ export class WebhookHandler { await this.handleStatus(status); } } - } catch (error) { - throw new Error(`Failed to handle webhook event: ${error.message}`); + } catch (error: unknown) { + if (error instanceof Error) { + throw new Error( + `Failed to send WhatsApp message: ${error.message}` + ); + } + throw new Error("Failed to send WhatsApp message"); } }