chore: add connection/send logs and web error surfacing
This commit is contained in:
@@ -39,14 +39,19 @@ export async function sendCommand(
|
|||||||
if (waitSeconds !== 0) {
|
if (waitSeconds !== 0) {
|
||||||
runtime.log(info("Wait/poll are Twilio-only; ignored for provider=web."));
|
runtime.log(info("Wait/poll are Twilio-only; ignored for provider=web."));
|
||||||
}
|
}
|
||||||
const res = await deps.sendMessageWeb(
|
const res = await deps
|
||||||
opts.to,
|
.sendMessageWeb(
|
||||||
opts.message,
|
opts.to,
|
||||||
{
|
opts.message,
|
||||||
verbose: false,
|
{
|
||||||
mediaUrl: opts.media,
|
verbose: false,
|
||||||
},
|
mediaUrl: opts.media,
|
||||||
);
|
},
|
||||||
|
)
|
||||||
|
.catch((err) => {
|
||||||
|
runtime.error(`❌ Web send failed: ${String(err)}`);
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
if (opts.json) {
|
if (opts.json) {
|
||||||
runtime.log(
|
runtime.log(
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ export async function sendMessageWeb(
|
|||||||
): Promise<{ messageId: string; toJid: string }> {
|
): Promise<{ messageId: string; toJid: string }> {
|
||||||
const sock = await createWaSocket(false, options.verbose);
|
const sock = await createWaSocket(false, options.verbose);
|
||||||
try {
|
try {
|
||||||
|
logInfo("🔌 Connecting to WhatsApp Web…");
|
||||||
await waitForWaConnection(sock);
|
await waitForWaConnection(sock);
|
||||||
const jid = toWhatsappJid(to);
|
const jid = toWhatsappJid(to);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user