fix(claude-do): snake_case Serilog tokens + no Warning-log on cancelled hub calls
Message-template tokens must be snake_case (repo rule) -- fixes 4 PascalCase
tokens introduced in 57dd6766. TryInvokeAsync's swallowing catch also no
longer logs a Warning for OperationCanceledException, which is routine
(e.g. worker shutdown/reconnect), not a failure worth a trace.
ClaudeDo-Task: d2ae3831-733f-4d40-93d7-70c93da11590
This commit is contained in:
@@ -50,13 +50,13 @@ sealed class Program
|
|||||||
var version = Assembly.GetEntryAssembly()?
|
var version = Assembly.GetEntryAssembly()?
|
||||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
|
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
|
||||||
?? "0.0.0";
|
?? "0.0.0";
|
||||||
Log.Information("ClaudeDo.App starting (version: {Version})", version);
|
Log.Information("ClaudeDo.App starting (version: {version})", version);
|
||||||
|
|
||||||
// Last-resort net: any exception that misses every other handler still gets one
|
// Last-resort net: any exception that misses every other handler still gets one
|
||||||
// Fatal line in the log before the process dies.
|
// Fatal line in the log before the process dies.
|
||||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||||
{
|
{
|
||||||
Log.Fatal(e.ExceptionObject as Exception, "Unhandled exception, terminating (IsTerminating: {IsTerminating})", e.IsTerminating);
|
Log.Fatal(e.ExceptionObject as Exception, "Unhandled exception, terminating (is_terminating: {is_terminating})", e.IsTerminating);
|
||||||
Log.CloseAndFlush();
|
Log.CloseAndFlush();
|
||||||
};
|
};
|
||||||
TaskScheduler.UnobservedTaskException += (_, e) =>
|
TaskScheduler.UnobservedTaskException += (_, e) =>
|
||||||
|
|||||||
@@ -304,11 +304,12 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
|
|||||||
ok = true;
|
ok = true;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||||
{
|
{
|
||||||
Serilog.Log.Warning(ex, "Hub call {Method} failed", method);
|
Serilog.Log.Warning(ex, "Hub call {method_name} failed", method);
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
|
catch { return default; }
|
||||||
finally { OperationTiming.Shared.Record("hub", method, sw.Elapsed, ok); }
|
finally { OperationTiming.Shared.Record("hub", method, sw.Elapsed, ok); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +325,7 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Serilog.Log.Warning(ex, "Hub call {Method} failed", method);
|
Serilog.Log.Warning(ex, "Hub call {method_name} failed", method);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
finally { OperationTiming.Shared.Record("hub", method, sw.Elapsed, ok); }
|
finally { OperationTiming.Shared.Record("hub", method, sw.Elapsed, ok); }
|
||||||
@@ -343,7 +344,7 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Serilog.Log.Warning(ex, "Hub call {Method} failed", method);
|
Serilog.Log.Warning(ex, "Hub call {method_name} failed", method);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
finally { OperationTiming.Shared.Record("hub", method, sw.Elapsed, ok); }
|
finally { OperationTiming.Shared.Record("hub", method, sw.Elapsed, ok); }
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
|
|||||||
private void FlashFooter(string message, WorkerLogLevel level)
|
private void FlashFooter(string message, WorkerLogLevel level)
|
||||||
{
|
{
|
||||||
if (level == WorkerLogLevel.Error)
|
if (level == WorkerLogLevel.Error)
|
||||||
Serilog.Log.Warning("Footer error: {Message}", message);
|
Serilog.Log.Warning("Footer error: {message}", message);
|
||||||
|
|
||||||
WorkerLogText = $"{DateTime.Now:HH:mm} · {message}";
|
WorkerLogText = $"{DateTime.Now:HH:mm} · {message}";
|
||||||
WorkerLogLevel = level;
|
WorkerLogLevel = level;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public sealed class HubExceptionLoggingFilter(ILogger<HubExceptionLoggingFilter>
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.LogWarning(ex, "Hub method {Method} failed", invocationContext.HubMethodName);
|
logger.LogWarning(ex, "Hub method {method_name} failed", invocationContext.HubMethodName);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user