补充浏览器握手超时具体正文
保留 DevTools stderr 作为超时诊断 detail
This commit is contained in:
@@ -114,7 +114,7 @@ fn parse_devtools_ws_url(line: &str) -> Option<String> {
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
enum OwnedBrowserLaunchError {
|
||||
SpawnFailed(String),
|
||||
WsTimeout,
|
||||
WsTimeout(String),
|
||||
WsFailed(String),
|
||||
ConnectTimeout,
|
||||
ConnectFailed(String),
|
||||
@@ -124,7 +124,7 @@ impl OwnedBrowserLaunchError {
|
||||
fn stage(&self) -> BrowserLaunchStage {
|
||||
match self {
|
||||
Self::SpawnFailed(_) => BrowserLaunchStage::Spawn,
|
||||
Self::WsTimeout | Self::WsFailed(_) => BrowserLaunchStage::WsHandshake,
|
||||
Self::WsTimeout(_) | Self::WsFailed(_) => BrowserLaunchStage::WsHandshake,
|
||||
Self::ConnectTimeout | Self::ConnectFailed(_) => BrowserLaunchStage::CdpConnect,
|
||||
}
|
||||
}
|
||||
@@ -132,14 +132,14 @@ impl OwnedBrowserLaunchError {
|
||||
fn is_recoverable(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::WsTimeout | Self::WsFailed(_) | Self::ConnectTimeout | Self::ConnectFailed(_)
|
||||
Self::WsTimeout(_) | Self::WsFailed(_) | Self::ConnectTimeout | Self::ConnectFailed(_)
|
||||
)
|
||||
}
|
||||
|
||||
fn code(&self) -> &'static str {
|
||||
match self {
|
||||
Self::SpawnFailed(_) => "browser-spawn-failed",
|
||||
Self::WsTimeout => "browser-ws-timeout",
|
||||
Self::WsTimeout(_) => "browser-ws-timeout",
|
||||
Self::WsFailed(_) => "browser-ws-failed",
|
||||
Self::ConnectTimeout => "browser-cdp-connect-timeout",
|
||||
Self::ConnectFailed(_) => "browser-cdp-connect-failed",
|
||||
@@ -151,7 +151,8 @@ impl OwnedBrowserLaunchError {
|
||||
Self::SpawnFailed(detail) | Self::WsFailed(detail) | Self::ConnectFailed(detail) => {
|
||||
Some(detail)
|
||||
}
|
||||
Self::WsTimeout | Self::ConnectTimeout => None,
|
||||
Self::WsTimeout(detail) => Some(detail),
|
||||
Self::ConnectTimeout => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -334,7 +335,9 @@ async fn devtools_ws_url_from_stderr(
|
||||
match tokio::time::timeout(timeout, read).await {
|
||||
Ok(Ok(url)) => Ok((url, reader)),
|
||||
Ok(Err(error)) => Err(error),
|
||||
Err(_) => Err(OwnedBrowserLaunchError::WsTimeout),
|
||||
Err(_) => Err(OwnedBrowserLaunchError::WsTimeout(safe_browser_detail(
|
||||
&captured,
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user