improve error output when configuration is invalid
This commit is contained in:
parent
9a6d7c6a20
commit
ea18a286b2
@ -412,7 +412,7 @@ namespace IW4MAdmin.Application
|
||||
|
||||
if (!validationResult.IsValid)
|
||||
{
|
||||
throw new ConfigurationException(_translationLookup["MANAGER_CONFIGURATION_ERROR"])
|
||||
throw new ConfigurationException("Could not validate configuration")
|
||||
{
|
||||
Errors = validationResult.Errors.Select(_error => _error.ErrorMessage).ToArray(),
|
||||
ConfigurationFileName = ConfigHandler.FileName
|
||||
|
@ -18,6 +18,7 @@ using SharedLibraryCore.Repositories;
|
||||
using SharedLibraryCore.Services;
|
||||
using Stats.Dtos;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
@ -138,11 +139,8 @@ namespace IW4MAdmin.Application
|
||||
|
||||
if (e is ConfigurationException configException)
|
||||
{
|
||||
if (translationLookup != null)
|
||||
{
|
||||
Console.WriteLine(translationLookup[configException.Message]
|
||||
.FormatExt(configException.ConfigurationFileName));
|
||||
}
|
||||
Console.WriteLine("{{fileName}} contains an error."
|
||||
.FormatExt(Path.GetFileName(configException.ConfigurationFileName)));
|
||||
|
||||
foreach (var error in configException.Errors)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ namespace IW4MAdmin.Application.Misc
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ConfigurationException("MANAGER_CONFIGURATION_ERROR")
|
||||
throw new ConfigurationException("Could not load configuration")
|
||||
{
|
||||
Errors = new[] { e.Message },
|
||||
ConfigurationFileName = FileName
|
||||
|
Loading…
Reference in New Issue
Block a user