// Copyright Epic Games, Inc. All Rights Reserved.
namespace HordeServer.Configuration
{
///
/// Exception thrown when reading config files
///
public sealed class ConfigException : Exception
{
readonly ConfigContext _context;
///
/// Stack of properties
///
public IEnumerable ScopeStack => _context.ScopeStack;
///
/// Constructor
///
/// Current parse context for the error
/// Description of the error
/// Inner exception details
public ConfigException(ConfigContext context, string message, Exception? innerException = null)
: base(message, innerException)
{
_context = context;
}
///
/// Gets the parser context when this exception was thrown. This is not exposed as a public property to avoid serializing the whole thing to Serilog.
///
public ConfigContext GetContext() => _context;
}
}