using TightWiki.Engine.Library.Interfaces;
using TightWiki.Repository;
namespace TightWiki.Engine.Implementation
{
///
/// Handles exceptions thrown by the wiki engine.
///
public class ExceptionHandler : IExceptionHandler
{
///
/// Called when an exception is thrown by the wiki engine.
///
/// Reference to the wiki state object
/// Optional exception, in the case that this was an actual exception.
/// Text that accompanies the exception.
public void Log(ITightEngineState state, Exception? ex, string customText)
{
if (ex != null)
{
ExceptionRepository.InsertException(ex, customText);
}
ExceptionRepository.InsertException(customText);
}
}
}