chore: report exception of command on failure#8852
Conversation
|
Windows and Mac build successful in Unity Cloud! You can find a link to the downloadable artifact below. |
|
Claude finished @NickKhalow's task in 1m 18s —— View job Review
Root-Cause CheckProblem being solved: Exceptions thrown by chat commands were silently swallowed in the Assessment: The diff directly addresses the observability gap — this fixes the root cause, not a symptom. Blocking Issues1.
The Per CLAUDE.md §9: "Ignore Fix: catch (Exception e) when (e is not OperationCanceledException)
{
SendFromSystem(channelId, channelType, "🔴 Error running command.");
ReportHub.LogException(e, new ReportData(ReportCategory.UNSPECIFIED));
}
catch (OperationCanceledException) { /* expected on command restart */ }2. Use
Per CLAUDE.md §9: "Log/report all others via Fix: Replace Non-Blocking Warning
REVIEW_RESULT: FAIL ❌ |
| catch (Exception e) | ||
| { | ||
| SendFromSystem(channelId, channelType, "🔴 Error running command."); | ||
| ReportHub.LogError(ReportCategory.UNSPECIFIED, $"Error running command: {e}"); |
There was a problem hiding this comment.
Per CLAUDE.md §9, exceptions should be reported via ReportHub.LogException (not LogError with a string). LogException preserves structured exception data in the diagnostics system.
Also, OperationCanceledException should not be logged as an error — it's expected when commandCts.SafeRestart() cancels an in-flight command.
| ReportHub.LogError(ReportCategory.UNSPECIFIED, $"Error running command: {e}"); | |
| ReportHub.LogException(e, new ReportData(ReportCategory.UNSPECIFIED)); |
And add a guard to the catch clause:
catch (Exception e) when (e is not OperationCanceledException)|
PR #8852, run #26232829470 Builds: Windows change, Windows baseline, macOS change, macOS baseline Framework 13 i7
|
What does this PR change?
When a chat command throws an exception, the error was caught and a generic "🔴 Error running command." message was shown to the user — but the exception itself was silently swallowed, making it impossible to diagnose failures from logs.
This PR adds a
ReportHub.LogErrorcall inside thecatchblock inCommandsHandleChatMessageBus.HandleChatCommandAsync, so the full exception (message + stack trace) is now reported to the diagnostics system alongside the user-facing error message.Changes
CommandsHandleChatMessageBus.cs: Capture the exception variable in thecatchblock and log it viaReportHub.LogError(ReportCategory.UNSPECIFIED, ...).using DCL.Diagnosticsimport.Test Instructions
Steps (standard run):
Expected result:
ReportHub.Quality Checklist