public class DataLoaderException:Exception { private LogLevel _vLevel = LogLevel.None; private string _vsMessage = string.Empty; public LogLevel Level { get { return _vLevel; } } public string Message { get { return _vsMessage; } } public DataLoaderException(LogLevel level,string message):base(message) { _vLevel = level; _vsMessage = message; } }
使用方法:
if (instanceTypes[3] == "")
throw new DataLoaderException(LogLevel.Error, "Manufacturer in config.xml cann't be empty.");