appexception.cs
来自「企业内部沟通系统」· CS 代码 · 共 42 行
CS
42 行
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 + =
减小字号Ctrl + -
显示快捷键?