aboutsummaryrefslogtreecommitdiff
path: root/src/cdp/errors.ts
diff options
context:
space:
mode:
authoramankumarsingh77 <amankumarsingh7702@gmail.com>2026-07-28 21:50:38 +0530
committerAman Kumar <145339995+amankumarsingh77@users.noreply.github.com>2026-08-02 19:12:46 +0530
commit893a9d338ceb5d37aefece1df637c9a5888a120e (patch)
tree5332fab5d515fce62e44ea68ee5408ddd128db44 /src/cdp/errors.ts
parent6d300099a86cfdb92b7869dc2b4f33094554b24c (diff)
refactor: one CDP transport, not two
createCdpTransport was a second full WebSocket-to-Chrome implementation reachable only through client.ts's `?? createCdpTransport()` fallback, which production never took — every session and every automated test passes the daemon transport. transport.ts now holds only the CdpTransport interface, and the client requires a transport instead of inventing one. The "Session with given id not found" match that both transports carried becomes classifyRemoteError in cdp/errors.ts, next to the error kind it produces. test/manual/profile-concurrency-test.ts was the sole caller of the fallback: it drives its own Chrome on a private port. It now spawns a daemon per scenario with BU_CDP_WS set, and refuses to run when a daemon is already up, since that one is bound to a different browser. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/cdp/errors.ts')
-rw-r--r--src/cdp/errors.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cdp/errors.ts b/src/cdp/errors.ts
index cf1dab7..bf77bbd 100644
--- a/src/cdp/errors.ts
+++ b/src/cdp/errors.ts
@@ -12,6 +12,10 @@ export type CdpError = {
readonly method?: string;
};
+// Chrome reports a dead session as a generic protocol error, so the message text is the only signal that a reattach — not a retry — is what will fix it.
+export const classifyRemoteError = (message: string): CdpErrorKind =>
+ message.includes("Session with given id not found") ? "session_not_found" : "remote_error";
+
export const cdpError = (
kind: CdpErrorKind,
message: string,