refactor(errors): surface 57 deferred catch-and-swallow sites via logger
The earlier sweep cleaned the hot path (worker/runtime/automation/api-
server/ipc core — 59 sites). This pass finishes the deferred long tail:
main/* services, database/* CRUD modules, api-server/* routes, ipc-*
handlers, thread-integration, automation helpers, browser, skills.
Default strategy: catch (error) { logger.warn("[module] context:", ...) }
— preserve current behavior, make the failure visible instead of
silently hidden. Widened 3 logger interface signatures to include warn
where callers only passed info/error previously (thread-helpers,
host-environment-service, ipc-domain-common).
Legitimate boundaries left intact: JSON.parse on untrusted input, DNS
resolver no-records paths, explicit safe* helpers (safeJson, parseJson,
parseTriggerDetail), URL-parse predicates, and `<unserialisable>`
fallbacks inside the prompt-builder summarisers. Each kept catch now
either has a reason in context or is a documented safe* helper.
Tests adjusted only where test-constructed no-op loggers needed a warn
stub (message-dispatch, company-mode-switch, ipc-agent-graph-handlers).
With the earlier pass, AgentCompany no longer has silently-swallowing
catch blocks in main-process or renderer business code.
This commit is contained in:
1 parent
ecd1bc2e33
commit
40040b3dd2
46 files changed
+209
-113
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import log from "electron-log/main.js";
|
||||
import { resolveApprovalDecision } from "./approval-policy";
|
||||
import type { AppDatabase } from "./database";
|
||||
|
||||
@@ -35,7 +36,8 @@ function collectImpactedAgentIdsFromWaitStates(db: AppDatabase, companyId: strin
|
||||
if (task.assigneeAgentId) {
|
||||
agentIds.add(task.assigneeAgentId);
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
log.warn(`[execution-mode-reconciler] getTask failed for ${thread.relatedEntityId}:`, err instanceof Error ? err.message : String(err));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -71,7 +73,8 @@ function collectImpactedAgentIdsFromReviewState(db: AppDatabase, companyId: stri
|
||||
if (task.assigneeAgentId) {
|
||||
agentIds.add(task.assigneeAgentId);
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
log.warn(`[execution-mode-reconciler] getTask failed for approval ${approval.relatedTaskId}:`, err instanceof Error ? err.message : String(err));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -87,7 +90,8 @@ function resumeAgents(db: AppDatabase, companyId: string, agentIds: Iterable<str
|
||||
if (!agent.heartbeatEnabled) {
|
||||
db.setHeartbeat(agent.id, true, agent.heartbeatIntervalSec || 120);
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
log.warn(`[execution-mode-reconciler] resumeAgents failed for ${agentId}:`, err instanceof Error ? err.message : String(err));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user