MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / run_direct_fallback

Function run_direct_fallback

src/lib.rs:936–955  ·  view source on GitHub ↗

Fall back to direct execution when the daemon is unavailable.

(cli: &Cli, ws_url: &str, error: &anyhow::Error)

Source from the content-addressed store, hash-verified

934
935/// Fall back to direct execution when the daemon is unavailable.
936async fn run_direct_fallback(cli: &Cli, ws_url: &str, error: &anyhow::Error) -> Result<()> {
937 eprintln!("Warning: daemon unavailable ({error}), running directly");
938 let cmd_name = cli.command_name();
939 let start = std::time::Instant::now();
940 let result = run_direct(cli, ws_url).await;
941 let duration = start.elapsed();
942 match &result {
943 Ok(r) => {
944 telemetry::log_command(cmd_name, duration, true, r.error_code);
945 print_result(r);
946 }
947 Err(e) => {
948 let code = e
949 .downcast_ref::<error::CliError>()
950 .map(|ce| ce.code().code());
951 telemetry::log_command(cmd_name, duration, false, code);
952 }
953 }
954 result.map(|_| ())
955}
956
957/// Direct execution without daemon (fallback).
958async fn run_direct(cli: &Cli, ws_url: &str) -> Result<result::CommandResult> {

Callers 1

runFunction · 0.85

Calls 5

run_directFunction · 0.85
log_commandFunction · 0.85
print_resultFunction · 0.85
command_nameMethod · 0.80
codeMethod · 0.80

Tested by

no test coverage detected