Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/OpenClaw.Shared/Capabilities/BrowserProxyCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,23 @@ public override async Task<NodeInvokeResponse> ExecuteAsync(NodeInvokeRequest re
}
catch (HttpRequestException ex)
{
return Error($"Browser control host is not reachable on 127.0.0.1:{controlPort}: {ex.Message}. {BuildReachabilityGuidance(controlPort, _sshRemoteGatewayPort)}");
Logger.Warn($"browser proxy: control host unreachable on 127.0.0.1:{controlPort}: {ex.Message}");
return Error($"Browser control host is not reachable on 127.0.0.1:{controlPort}. {BuildReachabilityGuidance(controlPort, _sshRemoteGatewayPort)}");
}
catch (JsonException ex)
{
return Error($"Browser control host returned invalid JSON: {ex.Message}");
Logger.Warn($"browser proxy: control host returned invalid JSON: {ex.Message}");
return Error("Browser control host returned invalid JSON");
}
catch (IOException ex)
{
return Error($"Browser proxy file read failed: {ex.Message}");
Logger.Warn($"browser proxy: file read failed: {ex.Message}");
return Error("Browser proxy file read failed");
}
catch (UnauthorizedAccessException ex)
{
return Error($"Browser proxy file read denied: {ex.Message}");
Logger.Warn($"browser proxy: file read denied: {ex.Message}");
return Error("Browser proxy file read denied");
}
}

Expand Down
18 changes: 11 additions & 7 deletions src/OpenClaw.Shared/Capabilities/CanvasCapability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ private async Task<NodeInvokeResponse> HandleNavigateAsync(NodeInvokeRequest req
}
catch (Exception ex)
{
Logger.Error($"canvas.navigate handler failed: {ex.Message}", ex);
return Error($"Navigate failed: {ex.Message}");
Logger.Error("canvas.navigate handler failed", ex);
return Error("Navigate failed");
}
}

Expand Down Expand Up @@ -246,7 +246,8 @@ private async Task<NodeInvokeResponse> HandleEvalAsync(NodeInvokeRequest request
}
catch (Exception ex)
{
return Error($"Eval failed: {ex.Message}");
Logger.Error("canvas.eval handler failed", ex);
return Error("Eval failed");
}
}

Expand Down Expand Up @@ -277,7 +278,8 @@ private async Task<NodeInvokeResponse> HandleSnapshotAsync(NodeInvokeRequest req
}
catch (Exception ex)
{
return Error($"Snapshot failed: {ex.Message}");
Logger.Error("canvas.snapshot handler failed", ex);
return Error("Snapshot failed");
}
}

Expand Down Expand Up @@ -367,7 +369,7 @@ private string ReadValidatedJsonlPath(string jsonlPath, string command)
}
catch (Exception ex)
{
throw new InvalidOperationException($"Invalid jsonlPath: {ex.Message}", ex);
throw new InvalidOperationException("Invalid jsonlPath", ex);
}

if (!IsPathWithinRoot(fullPath, tempRoot))
Expand Down Expand Up @@ -497,7 +499,8 @@ private async Task<NodeInvokeResponse> HandleA2UIDumpAsync()
}
catch (Exception ex)
{
return Error($"CANVAS_DUMP_FAILED: {ex.Message}");
Logger.Error("canvas.a2ui.dump handler failed", ex);
return Error("CANVAS_DUMP_FAILED");
}
}

Expand All @@ -523,7 +526,8 @@ private async Task<NodeInvokeResponse> HandleCapsAsync()
}
catch (Exception ex)
{
return Error($"CANVAS_CAPS_FAILED: {ex.Message}");
Logger.Error("canvas.a2ui.caps handler failed", ex);
return Error("CANVAS_CAPS_FAILED");
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions tests/OpenClaw.Shared.Tests/CapabilityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,8 @@ public async Task Navigate_HandlerThrows_SurfacesAsError()
};
var res = await cap.ExecuteAsync(req);
Assert.False(res.Ok);
Assert.Contains("browser refused", res.Error);
Assert.Contains("Navigate failed", res.Error);
Assert.DoesNotContain("browser refused", res.Error);
}

[Fact]
Expand All @@ -1389,7 +1390,8 @@ public async Task Eval_ReturnsError_WhenHandlerThrows()
};
var res = await cap.ExecuteAsync(req);
Assert.False(res.Ok);
Assert.Contains("WebView2 not ready", res.Error);
Assert.Contains("Eval failed", res.Error);
Assert.DoesNotContain("WebView2 not ready", res.Error);
}

[Fact]
Expand Down Expand Up @@ -1426,7 +1428,8 @@ public async Task Snapshot_ReturnsError_WhenHandlerThrows()
var req = new NodeInvokeRequest { Id = "c15", Command = "canvas.snapshot", Args = Parse("""{}""") };
var res = await cap.ExecuteAsync(req);
Assert.False(res.Ok);
Assert.Contains("Canvas not visible", res.Error);
Assert.Contains("Snapshot failed", res.Error);
Assert.DoesNotContain("Canvas not visible", res.Error);
}

[Fact]
Expand Down Expand Up @@ -1541,7 +1544,7 @@ public async Task A2UIDump_ReturnsError_WhenHandlerThrows()
var res = await cap.ExecuteAsync(req);
Assert.False(res.Ok);
Assert.Contains("CANVAS_DUMP_FAILED", res.Error);
Assert.Contains("dispatcher gone", res.Error);
Assert.DoesNotContain("dispatcher gone", res.Error);
}

[Fact]
Expand Down
Loading