SEBWIN-485: Improved generic startup, session and shutdown error messages by adding all existing log file paths.
This commit is contained in:
		
							parent
							
								
									7b822b0278
								
							
						
					
					
						commit
						cc8d8dddfc
					
				
					 2 changed files with 33 additions and 5 deletions
				
			
		|  | @ -491,7 +491,7 @@ namespace SafeExamBrowser.Runtime.UnitTests | ||||||
| 
 | 
 | ||||||
| 			sut.Terminate(); | 			sut.Terminate(); | ||||||
| 
 | 
 | ||||||
| 			messageBox.Verify(m => m.Show(It.IsAny<TextKey>(), It.IsAny<TextKey>(), It.IsAny<MessageBoxAction>(), It.IsAny<MessageBoxIcon>(), It.IsAny<IWindow>()), Times.AtLeastOnce); | 			messageBox.Verify(m => m.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxAction>(), It.IsAny<MessageBoxIcon>(), It.IsAny<IWindow>()), Times.AtLeastOnce); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		[TestMethod] | 		[TestMethod] | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| using System; | using System; | ||||||
|  | using System.IO; | ||||||
| using System.Linq; | using System.Linq; | ||||||
| using System.Threading; | using System.Threading; | ||||||
| using SafeExamBrowser.Communication.Contracts.Data; | using SafeExamBrowser.Communication.Contracts.Data; | ||||||
|  | @ -115,7 +116,7 @@ namespace SafeExamBrowser.Runtime | ||||||
| 				logger.Info("Application startup aborted!"); | 				logger.Info("Application startup aborted!"); | ||||||
| 				logger.Log(string.Empty); | 				logger.Log(string.Empty); | ||||||
| 
 | 
 | ||||||
| 				messageBox.Show(TextKey.MessageBox_StartupError, TextKey.MessageBox_StartupErrorTitle, icon: MessageBoxIcon.Error, parent: splashScreen); | 				messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_StartupError), text.Get(TextKey.MessageBox_StartupErrorTitle), icon: MessageBoxIcon.Error, parent: splashScreen); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			return initialized && SessionIsRunning; | 			return initialized && SessionIsRunning; | ||||||
|  | @ -151,7 +152,7 @@ namespace SafeExamBrowser.Runtime | ||||||
| 				logger.Info("Shutdown procedure failed!"); | 				logger.Info("Shutdown procedure failed!"); | ||||||
| 				logger.Log(string.Empty); | 				logger.Log(string.Empty); | ||||||
| 
 | 
 | ||||||
| 				messageBox.Show(TextKey.MessageBox_ShutdownError, TextKey.MessageBox_ShutdownErrorTitle, icon: MessageBoxIcon.Error, parent: splashScreen); | 				messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_ShutdownError), text.Get(TextKey.MessageBox_ShutdownErrorTitle), icon: MessageBoxIcon.Error, parent: splashScreen); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			splashScreen.Close(); | 			splashScreen.Close(); | ||||||
|  | @ -212,14 +213,14 @@ namespace SafeExamBrowser.Runtime | ||||||
| 			{ | 			{ | ||||||
| 				StopSession(); | 				StopSession(); | ||||||
| 
 | 
 | ||||||
| 				messageBox.Show(TextKey.MessageBox_SessionStartError, TextKey.MessageBox_SessionStartErrorTitle, icon: MessageBoxIcon.Error, parent: runtimeWindow); | 				messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_SessionStartError), text.Get(TextKey.MessageBox_SessionStartErrorTitle), icon: MessageBoxIcon.Error, parent: runtimeWindow); | ||||||
| 
 | 
 | ||||||
| 				logger.Info("Terminating application..."); | 				logger.Info("Terminating application..."); | ||||||
| 				shutdown.Invoke(); | 				shutdown.Invoke(); | ||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
| 				messageBox.Show(TextKey.MessageBox_SessionStartError, TextKey.MessageBox_SessionStartErrorTitle, icon: MessageBoxIcon.Error, parent: runtimeWindow); | 				messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_SessionStartError), text.Get(TextKey.MessageBox_SessionStartErrorTitle), icon: MessageBoxIcon.Error, parent: runtimeWindow); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -700,5 +701,32 @@ namespace SafeExamBrowser.Runtime | ||||||
| 
 | 
 | ||||||
| 			return $"### {dashesLeft} {message} {dashesRight} ###"; | 			return $"### {dashesLeft} {message} {dashesRight} ###"; | ||||||
| 		} | 		} | ||||||
|  | 
 | ||||||
|  | 		private string AppendLogFilePaths(TextKey key) | ||||||
|  | 		{ | ||||||
|  | 			var message = text.Get(key); | ||||||
|  | 
 | ||||||
|  | 			if (File.Exists(appConfig.BrowserLogFilePath)) | ||||||
|  | 			{ | ||||||
|  | 				message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.BrowserLogFilePath}"; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (File.Exists(appConfig.ClientLogFilePath)) | ||||||
|  | 			{ | ||||||
|  | 				message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.ClientLogFilePath}"; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (File.Exists(appConfig.RuntimeLogFilePath)) | ||||||
|  | 			{ | ||||||
|  | 				message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.RuntimeLogFilePath}"; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if (File.Exists(appConfig.ServiceLogFilePath)) | ||||||
|  | 			{ | ||||||
|  | 				message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.ServiceLogFilePath}"; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			return message; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Damian Büchel
						Damian Büchel