From 2d0412d366c1c243cc3abfe753f21d59b4c55473 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Jan 2012 22:35:55 +0000 Subject: Make errors reported by OpenSim when it halts because it can't find certain config sections or files a bit more user friendly. --- OpenSim/Region/Application/ConfigurationLoader.cs | 19 ++++++------------- OpenSim/Region/Application/OpenSimBase.cs | 6 +++--- OpenSim/Server/Base/ServicesServerBase.cs | 7 +++---- 3 files changed, 12 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 4a7c8b0..8d95c41 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -107,15 +107,13 @@ namespace OpenSim } else { - m_log.ErrorFormat("Master ini file {0} not found", masterFilePath); + m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath)); Environment.Exit(1); } } } - - string iniFileName = - startupConfig.GetString("inifile", "OpenSim.ini"); + string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini"); if (IsUri(iniFileName)) { @@ -131,8 +129,7 @@ namespace OpenSim if (!File.Exists(Application.iniFilePath)) { iniFileName = "OpenSim.xml"; - Application.iniFilePath = Path.GetFullPath( - Path.Combine(Util.configDir(), iniFileName)); + Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName)); } if (File.Exists(Application.iniFilePath)) @@ -142,15 +139,12 @@ namespace OpenSim } } - string iniDirName = - startupConfig.GetString("inidirectory", "config"); - string iniDirPath = - Path.Combine(Util.configDir(), iniDirName); + string iniDirName = startupConfig.GetString("inidirectory", "config"); + string iniDirPath = Path.Combine(Util.configDir(), iniDirName); if (Directory.Exists(iniDirPath)) { - m_log.InfoFormat("Searching folder {0} for config ini files", - iniDirPath); + m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath); string[] fileEntries = Directory.GetFiles(iniDirName); foreach (string filePath in fileEntries) @@ -172,7 +166,6 @@ namespace OpenSim if (sources.Count == 0) { m_log.FatalFormat("[CONFIG]: Could not load any configuration"); - m_log.FatalFormat("[CONFIG]: Did you copy the OpenSimDefaults.ini.example file to OpenSimDefaults.ini?"); Environment.Exit(1); } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 9f9b4f0..a680a59 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -202,16 +202,16 @@ namespace OpenSim // Load the simulation data service IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"]; if (simDataConfig == null) - throw new Exception("Configuration file is missing the [SimulationDataStore] section"); + throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?"); string module = simDataConfig.GetString("LocalServiceModule", String.Empty); if (String.IsNullOrEmpty(module)) - throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section"); + throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section."); m_simulationDataService = ServerUtils.LoadPlugin(module, new object[] { m_config.Source }); // Load the estate data service IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"]; if (estateDataConfig == null) - throw new Exception("Configuration file is missing the [EstateDataStore] section"); + throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?"); module = estateDataConfig.GetString("LocalServiceModule", String.Empty); if (String.IsNullOrEmpty(module)) throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index aeba35f..a6f4e47 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -126,11 +126,10 @@ namespace OpenSim.Server.Base m_Config = new IniConfigSource(iniFile); } } - catch (Exception) + catch (Exception e) { - System.Console.WriteLine("Error reading from config source {0}", - iniFile); - Thread.CurrentThread.Abort(); + System.Console.WriteLine("Error reading from config source. {0}", e.Message); + Environment.Exit(1); } // Merge the configuration from the command line into the -- cgit v1.1