aboutsummaryrefslogtreecommitdiff
path: root/src/cdp/errors.ts
diff options
context:
space:
mode:
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,