pub enum SessionError {
TabHung {
target_id: Option<String>,
url: Option<String>,
timeout_ms: u64,
hint: &'static str,
},
TabCrashed {
target_id: String,
reason: String,
},
TabNotFound {
browser: String,
name: String,
},
TargetGone {
kind: TargetKind,
details: String,
},
EngineUnsupported {
tool: String,
required_engine: String,
current_engine: String,
hint: &'static str,
},
SidecarConnectionFailed {
tool: String,
method: String,
target_id: String,
url: Option<String>,
details: String,
hint: &'static str,
},
RefUnknown {
element: String,
target_id: String,
},
StaleRef {
element: String,
target_id: String,
reason: &'static str,
},
NodeGone {
backend_node_id: u64,
details: String,
},
}Expand description
Typed errors raised from the page-session layer so callers (and tests) can
pattern-match on the failure category — in particular, TabHung is the
catch-all for the alive-but-unresponsive renderer case that has no
protocol event signal.
Variants§
TabHung
Op exceeded its per-call timeout without a reply and without a crash event. The most likely cause is a wedged renderer (service-worker suspended page, infinite loop, modal dialog, etc.). The agent should treat the tab as unusable until reloaded or recreated.
TabCrashed
Renderer crashed mid-op (observed via Target.targetCrashed /
Inspector.targetCrashed). Distinct from TabHung so callers can
distinguish “definitely dead” from “presumed wedged.”
TabNotFound
<browser>/<name> referenced a tab that doesn’t exist in the
tabs registry. Agents see this when they reference a tab they
haven’t tab open’d yet — the recovery is to open it first.
Distinct from TabHung because the tab was never there to wedge.
TargetGone
Protocol-level error indicating the underlying target/session/context
referenced by the request no longer exists in the browser. Raised by
the CDP/BiDi client layer when the server returns a recognised
“gone” code (e.g. no target with given id, no such frame). The
recover-once wrappers treat this as a signal to recreate the tab
and retry; otherwise it would surface as a generic protocol error.
EngineUnsupported
The requested operation cannot run against the currently selected
browser engine. Used by the Playwright sidecar tools (snapshot,
click, type, etc.) when the active browser is BiDi (Firefox) —
Playwright can’t drive a user-launched Firefox. The agent’s
recovery is to browser_select a Chromium-family browser, or
to use the engine-agnostic tools (browser_get_html,
browser_fetch, browser_navigate, etc.) which work on both engines.
SidecarConnectionFailed
A Playwright sidecar tool failed at the sidecar/CDP connection layer,
but browser-control’s native backend was still able to wake and probe
the target tab. This is intentionally distinct from TabHung: agents
should not treat it as evidence that the page or app is stuck.
Fields
RefUnknown
An element ref (e12) was passed that this tab’s ref table has
never handed out. Refs come from browser_snapshot / browser_find;
the agent must take one first.
StaleRef
A known ref no longer resolves: the page navigated (document token changed) or the node was removed. The agent must re-snapshot.
NodeGone
Native CDP input could not resolve a backendDOMNodeId (the node
left the document). Mapped to SessionError::StaleRef by the tool
layer, which knows the agent-facing ref.
Trait Implementations§
Source§impl Debug for SessionError
impl Debug for SessionError
Source§impl Display for SessionError
impl Display for SessionError
Source§impl Error for SessionError
impl Error for SessionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for SessionError
impl RefUnwindSafe for SessionError
impl Send for SessionError
impl Sync for SessionError
impl Unpin for SessionError
impl UnsafeUnpin for SessionError
impl UnwindSafe for SessionError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more