mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:08:26 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -57,7 +57,9 @@ const TELEGRAM_POLL_RESTART_POLICY = {
|
||||
};
|
||||
|
||||
const isGetUpdatesConflict = (err: unknown) => {
|
||||
if (!err || typeof err !== "object") return false;
|
||||
if (!err || typeof err !== "object") {
|
||||
return false;
|
||||
}
|
||||
const typed = err as {
|
||||
error_code?: number;
|
||||
errorCode?: number;
|
||||
@@ -66,7 +68,9 @@ const isGetUpdatesConflict = (err: unknown) => {
|
||||
message?: string;
|
||||
};
|
||||
const errorCode = typed.error_code ?? typed.errorCode;
|
||||
if (errorCode !== 409) return false;
|
||||
if (errorCode !== 409) {
|
||||
return false;
|
||||
}
|
||||
const haystack = [typed.method, typed.description, typed.message]
|
||||
.filter((value): value is string => typeof value === "string")
|
||||
.join(" ")
|
||||
@@ -85,9 +89,13 @@ const NETWORK_ERROR_SNIPPETS = [
|
||||
];
|
||||
|
||||
const isNetworkRelatedError = (err: unknown) => {
|
||||
if (!err) return false;
|
||||
if (!err) {
|
||||
return false;
|
||||
}
|
||||
const message = formatErrorMessage(err).toLowerCase();
|
||||
if (!message) return false;
|
||||
if (!message) {
|
||||
return false;
|
||||
}
|
||||
return NETWORK_ERROR_SNIPPETS.some((snippet) => message.includes(snippet));
|
||||
};
|
||||
|
||||
@@ -111,7 +119,9 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) {
|
||||
accountId: account.accountId,
|
||||
});
|
||||
const persistUpdateId = async (updateId: number) => {
|
||||
if (lastUpdateId !== null && updateId <= lastUpdateId) return;
|
||||
if (lastUpdateId !== null && updateId <= lastUpdateId) {
|
||||
return;
|
||||
}
|
||||
lastUpdateId = updateId;
|
||||
try {
|
||||
await writeTelegramUpdateOffset({
|
||||
@@ -188,7 +198,9 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) {
|
||||
try {
|
||||
await sleepWithAbort(delayMs, opts.abortSignal);
|
||||
} catch (sleepErr) {
|
||||
if (opts.abortSignal?.aborted) return;
|
||||
if (opts.abortSignal?.aborted) {
|
||||
return;
|
||||
}
|
||||
throw sleepErr;
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user