📄 appexception.cs
字号:
using System;
using System.Diagnostics;
namespace infoWeb.WebModules
{
/// <summary>
/// Default exception to be thrown by the website, it will
/// automatically log the contents of the exception to the
/// Windows NT/2000 Application Event Log.
/// </summary>
public class AppException: System.Exception
{
public AppException()
{
LogEvent("An unexpected error occurred.");
}
public AppException(string message)
{
LogEvent(message);
}
public AppException(string message, Exception innerException)
{
LogEvent(message);
if (innerException != null)
{
LogEvent(innerException.Message);
}
}
private void LogEvent(string message)
{
if (!EventLog.SourceExists("ThePhile.COM"))
{
EventLog.CreateEventSource("ThePhile.COM", "Application");
}
EventLog.WriteEntry("ThePhile.COM", message, EventLogEntryType.Error);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -