mirror of
				https://github.com/MindWorkAI/AI-Studio.git
				synced 2025-11-04 02:00:20 +00:00 
			
		
		
		
	Added a handler for unobserved task exceptions
This commit is contained in:
		
							parent
							
								
									32819d3618
								
							
						
					
					
						commit
						57af2080f5
					
				@ -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;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user