mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 07:57:59 +00:00
Added a handler for unobserved task exceptions
This commit is contained in:
1 file changed
+7
@@ -187,6 +187,13 @@ internal sealed class Program
|
|||||||
await encryptionInitializer;
|
await encryptionInitializer;
|
||||||
await rust.AppIsReady();
|
await rust.AppIsReady();
|
||||||
programLogger.LogInformation("The AI Studio server is ready.");
|
programLogger.LogInformation("The AI Studio server is ready.");
|
||||||
|
|
||||||
|
TaskScheduler.UnobservedTaskException += (sender, taskArgs) =>
|
||||||
|
{
|
||||||
|
programLogger.LogError(taskArgs.Exception, $"Unobserved task exception by sender '{sender ?? "n/a"}'.");
|
||||||
|
taskArgs.SetObserved();
|
||||||
|
};
|
||||||
|
|
||||||
await serverTask;
|
await serverTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user