diff --git a/src/OpenClaw.Shared/Capabilities/DeviceCapability.cs b/src/OpenClaw.Shared/Capabilities/DeviceCapability.cs index e975f6cd2..2c05ae9ac 100644 --- a/src/OpenClaw.Shared/Capabilities/DeviceCapability.cs +++ b/src/OpenClaw.Shared/Capabilities/DeviceCapability.cs @@ -149,7 +149,7 @@ private async Task HandleStatusAsync(NodeInvokeRequest reque catch (Exception ex) { Logger.Warn($"device.status: {section} collection failed: {ex.Message}"); - return new { error = ex.Message }; + return new { error = "collection failed" }; } } @@ -159,7 +159,7 @@ private async Task HandleStatusAsync(NodeInvokeRequest reque catch (Exception ex) { Logger.Warn($"device.status: {section} collection failed: {ex.Message}"); - return new { error = ex.Message }; + return new { error = "collection failed" }; } } diff --git a/src/OpenClaw.Shared/WindowsNodeClient.cs b/src/OpenClaw.Shared/WindowsNodeClient.cs index 4c35522a7..776b2b54e 100644 --- a/src/OpenClaw.Shared/WindowsNodeClient.cs +++ b/src/OpenClaw.Shared/WindowsNodeClient.cs @@ -481,9 +481,9 @@ private async Task HandleNodeInvokeEventAsync(JsonElement root) catch (Exception ex) { _logger.Error($"[NODE] Command execution failed: {command}", ex); - await SendNodeInvokeResultAsync(requestId, false, null, $"Execution failed: {ex.Message}"); + await SendNodeInvokeResultAsync(requestId, false, null, "Command execution failed"); stopwatch.Stop(); - RaiseInvokeCompleted(requestId, command, false, $"Execution failed: {ex.Message}", stopwatch.Elapsed); + RaiseInvokeCompleted(requestId, command, false, "Command execution failed", stopwatch.Elapsed); } } @@ -1003,9 +1003,9 @@ private async Task HandleNodeInvokeAsync(JsonElement root, string? requestId) catch (Exception ex) { _logger.Error($"Command execution failed: {command}", ex); - await SendErrorResponseAsync(requestId, $"Execution failed: {ex.Message}"); + await SendErrorResponseAsync(requestId, "Command execution failed"); stopwatch.Stop(); - RaiseInvokeCompleted(requestId, command, false, $"Execution failed: {ex.Message}", stopwatch.Elapsed); + RaiseInvokeCompleted(requestId, command, false, "Command execution failed", stopwatch.Elapsed); } } diff --git a/src/OpenClaw.Tray.WinUI/Services/ExecApprovalPromptService.cs b/src/OpenClaw.Tray.WinUI/Services/ExecApprovalPromptService.cs index 892b4ba0c..53e2a3126 100644 --- a/src/OpenClaw.Tray.WinUI/Services/ExecApprovalPromptService.cs +++ b/src/OpenClaw.Tray.WinUI/Services/ExecApprovalPromptService.cs @@ -87,7 +87,7 @@ public Task RequestAsync( catch (Exception ex) { _logger.Warn($"[ExecApproval] Prompt failed: {ex.Message}"); - tcs.TrySetResult(ExecApprovalPromptDecision.Deny($"Prompt failed: {ex.Message}")); + tcs.TrySetResult(ExecApprovalPromptDecision.Deny("Approval prompt failed")); } })) { diff --git a/src/OpenClaw.Tray.WinUI/Services/UrlNavigationApprovalService.cs b/src/OpenClaw.Tray.WinUI/Services/UrlNavigationApprovalService.cs index 7893ce943..6845ee297 100644 --- a/src/OpenClaw.Tray.WinUI/Services/UrlNavigationApprovalService.cs +++ b/src/OpenClaw.Tray.WinUI/Services/UrlNavigationApprovalService.cs @@ -99,7 +99,7 @@ public Task RequestAsync( catch (Exception ex) { _logger.Warn($"[NavigationApproval] Prompt failed: {ex.Message}"); - return UrlNavigationApprovalDecision.Deny($"Prompt failed: {ex.Message}"); + return UrlNavigationApprovalDecision.Deny("Approval prompt failed"); } }, cancellationToken); } diff --git a/tests/OpenClaw.Shared.Tests/CapabilityTests.cs b/tests/OpenClaw.Shared.Tests/CapabilityTests.cs index 8b75c1fb5..93cb488c0 100644 --- a/tests/OpenClaw.Shared.Tests/CapabilityTests.cs +++ b/tests/OpenClaw.Shared.Tests/CapabilityTests.cs @@ -1813,7 +1813,7 @@ public async Task Status_BatterySection_GracefulOnFailure() Assert.True(res.Ok); var battery = GetPayload(res).GetProperty("battery"); Assert.NotEqual(JsonValueKind.Undefined, battery.GetProperty("error").ValueKind); - Assert.Contains("No battery hardware", battery.GetProperty("error").GetString()); + Assert.Equal("collection failed", battery.GetProperty("error").GetString()); // Legacy fields must still be present for backward compat Assert.True(battery.TryGetProperty("level", out _), "battery.level missing on failure path"); Assert.Equal("unknown", battery.GetProperty("state").GetString());