web: log disconnect error detail in reconnect loop
This commit is contained in:
@@ -30,7 +30,7 @@ import {
|
|||||||
resolveReconnectPolicy,
|
resolveReconnectPolicy,
|
||||||
sleepWithAbort,
|
sleepWithAbort,
|
||||||
} from "./reconnect.js";
|
} from "./reconnect.js";
|
||||||
import { getWebAuthAgeMs, readWebSelfId } from "./session.js";
|
import { formatError, getWebAuthAgeMs, readWebSelfId } from "./session.js";
|
||||||
|
|
||||||
const WEB_TEXT_LIMIT = 4000;
|
const WEB_TEXT_LIMIT = 4000;
|
||||||
const DEFAULT_GROUP_HISTORY_LIMIT = 50;
|
const DEFAULT_GROUP_HISTORY_LIMIT = 50;
|
||||||
@@ -1384,12 +1384,15 @@ export async function monitorWebProvider(
|
|||||||
"isLoggedOut" in reason &&
|
"isLoggedOut" in reason &&
|
||||||
(reason as { isLoggedOut?: boolean }).isLoggedOut;
|
(reason as { isLoggedOut?: boolean }).isLoggedOut;
|
||||||
|
|
||||||
|
const errorStr = formatError(reason);
|
||||||
|
|
||||||
reconnectLogger.info(
|
reconnectLogger.info(
|
||||||
{
|
{
|
||||||
connectionId,
|
connectionId,
|
||||||
status,
|
status,
|
||||||
loggedOut,
|
loggedOut,
|
||||||
reconnectAttempts,
|
reconnectAttempts,
|
||||||
|
error: errorStr,
|
||||||
},
|
},
|
||||||
"web reconnect: connection closed",
|
"web reconnect: connection closed",
|
||||||
);
|
);
|
||||||
@@ -1442,11 +1445,11 @@ export async function monitorWebProvider(
|
|||||||
},
|
},
|
||||||
"web reconnect: scheduling retry",
|
"web reconnect: scheduling retry",
|
||||||
);
|
);
|
||||||
runtime.error(
|
runtime.error(
|
||||||
danger(
|
danger(
|
||||||
`WhatsApp Web connection closed (status ${status}). Retry ${reconnectAttempts}/${reconnectPolicy.maxAttempts || "∞"} in ${formatDuration(delay)}…`,
|
`WhatsApp Web connection closed (status ${status}). Retry ${reconnectAttempts}/${reconnectPolicy.maxAttempts || "∞"} in ${formatDuration(delay)}… (${errorStr})`,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await closeListener();
|
await closeListener();
|
||||||
try {
|
try {
|
||||||
await sleep(delay, abortSignal);
|
await sleep(delay, abortSignal);
|
||||||
|
|||||||
Reference in New Issue
Block a user