public void GetPropertyError(string propertyName, ErrorInfo info) { if (propertyName == "CustomerType" && string.IsNullOrEmpty(CustomerType)) { info.ErrorText = "Please enter customer type"; } if (propertyName == "CustomerName" && string.IsNullOrEmpty(CustomerName)) { info.ErrorText = "Please enter customer name "; } if(propertyName=="MemberNo" && !string.IsNullOrEmpty(CustomerType)) { if (CustomerType == "0") { if(string.IsNullOrEmpty(MemberNo)) { info.ErrorText = "Please enter member no "; } } } if (propertyName == "CustomerId" && string.IsNullOrEmpty(CustomerId)) { info.ErrorText = "Please enter mobile no "; } else if (propertyName == "CustomerId" && !string.IsNullOrEmpty(CustomerId)) { if (new BlCustomer().CheckCustomerId(CustomerId, CustomerNo)) { info.ErrorText = "Duplicate mobile no "; } } }
public override void Append(ErrorInfo errorInfo) { var sb = new StringBuilder(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { sb.AppendLine(assembly.GetName().FullName); } sb.AppendLine(); // Get file info foreach (Assembly assembly in assemblies) { bool flag = false; try { if (assembly.Location.Length != 0) { sb.Append(FileVersionInfo.GetVersionInfo(assembly.Location).ToString()); flag = true; } } catch(Exception) { } if (!flag) { sb.Append(assembly.ToString()); } sb.AppendLine(); } errorInfo.AddDetail(this.Name, "", sb.ToString()); }
public override void Append(ErrorInfo error) { var pairs = new List<KeyValuePair<string, string>>(); foreach (AssemblyPart ap in Deployment.Current.Parts) { StreamResourceInfo sri = Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative)); if (sri != null) { Assembly assembly = new AssemblyPart().Load(sri.Stream); pairs.Add(Message("Assembly", assembly.FullName)); pairs.Add(Message("ImageRuntimeVersion", assembly.ImageRuntimeVersion)); try { if (assembly.Location.Length != 0) { pairs.Add(Message("Location", assembly.Location)); } } catch { } } } error.AddDetail(this.Name, pairs); }
public override void Append(ErrorInfo errorInfo) { Assembly assembly = errorInfo.GetType().Assembly; var pairs = new Dictionary<string, string>(); pairs.Add("Date", DateTime.Now.ToString()); pairs.Add("Culture", CultureInfo.CurrentCulture.Name); #if !SILVERLIGHT pairs.Add("User", string.Format(CultureInfo.InvariantCulture, @"{0}\{1}", Environment.UserDomainName, Environment.UserName).Trim('\\')); pairs.Add("Machine Name", Environment.MachineName); pairs.Add("App Start Time", Process.GetCurrentProcess().StartTime.ToLocalTime().ToString(CultureInfo.InvariantCulture)); pairs.Add("App Up Time", (DateTime.Now - Process.GetCurrentProcess().StartTime.ToLocalTime()).ToString()); pairs.Add("Worker process", GetWorkerProcess()); pairs.Add("AppDomain", AppDomainDetail(AppDomain.CurrentDomain)); pairs.Add("Deployment", (assembly.GlobalAssemblyCache) ? "GAC" : "bin"); #endif pairs.Add("Thread Id", Thread.CurrentThread.ManagedThreadId.ToString(CultureInfo.InvariantCulture)); pairs.Add("Full Name", new AssemblyName(assembly.FullName).FullName); pairs.Add("Operating System Version", Environment.OSVersion.ToString()); pairs.Add("Common Language Runtime Version", Environment.Version.ToString()); pairs.Add("Elmah.Everywhere Version", new AssemblyName(typeof(Diagnostics.ExceptionHandler).Assembly.FullName).Version.ToString()); errorInfo.AddDetail(this.Name, pairs); }
/// <summary> /// /// </summary> /// <param name="plcVarName"></param> /// <returns>ture added, false removed</returns> public Boolean IsWarnningAdded( ErrorInfo info) { Boolean result = false; if(info != null){ result = mSortedWarnningMap.ContainsKey(info.level); } return result; }
public void Appenders_Is_Null_Test() { // Act ErrorInfo error = new ErrorInfo(); // Assert Assert.Null(error.Appenders); }
/************************************************************************/ /************************************************************************/ public static int IsError(ErrorInfo e) { if (e.Value != 0) { MessageBox.Show(e.Message); return 1; } return 0; }
void IDXDataErrorInfo.GetError(ErrorInfo info) { if (StartDate > EndDate) { SetErrorInfo(info, "Either StartDate or EndDate should be corrected.", ErrorType.Critical); } }
public override void Append(ErrorInfo errorInfo) { var memorystatusex = new MemoryStatusEx(); if (NativeMethods.GlobalMemoryStatusEx(memorystatusex)) { errorInfo.AddDetail(this.Name, "Total Memory", string.Format(CultureInfo.InvariantCulture, "{0} MB", memorystatusex.ullTotalPhys / (1024 * 1024))); errorInfo.AddDetail(this.Name, "Available Memory", string.Format(CultureInfo.InvariantCulture, "{0} MB", memorystatusex.ullAvailPhys / (1024 * 1024))); } }
/// <summary> /// Add an error to the ErrorCollection. /// </summary> /// <param name="lineNumber">The line when the error occurs.</param> /// <param name="ex">The exception thrown, can be null.</param> /// <param name="recordLine">The record values</param> protected void AddError(int lineNumber, Exception ex, string recordLine) { ErrorInfo e = new ErrorInfo(); e.mLineNumber = lineNumber; // e.mColumnNumber = colNum; e.mExceptionInfo = ex; e.mRecordString = recordLine; mErrorManager.AddError(e); }
public void BuildMessage_Returns_Error_Detail_Message_If_ErrorDetails_Are_Empty_Test() { // Arrange ErrorInfo error = new ErrorInfo(new Exception()); // Act string detail = error.BuildMessage(); // Assert Assert.Equal(error.Detail, detail); }
public override void Append(ErrorInfo errorInfo) { var pairs = new Dictionary<string, string>(); pairs.Add("CellularMobileOperator", DeviceNetworkInformation.CellularMobileOperator); pairs.Add("IsCellularDataEnabled", DeviceNetworkInformation.IsCellularDataEnabled.ToString()); pairs.Add("IsCellularDataRoamingEnabled", DeviceNetworkInformation.IsCellularDataRoamingEnabled.ToString()); pairs.Add("IsNetworkAvailable", DeviceNetworkInformation.IsNetworkAvailable.ToString()); pairs.Add("IsWiFiEnabled", DeviceNetworkInformation.IsWiFiEnabled.ToString()); errorInfo.AddDetail(this.Name, pairs); }
public void GetPropertyError(string propertyName, ErrorInfo info) { if (propertyName == "Username" && string.IsNullOrEmpty(Username) || propertyName == "Fullname" && string.IsNullOrWhiteSpace(Fullname) || propertyName == "Empno" && string.IsNullOrEmpty(Empno) || propertyName == "Password" && string.IsNullOrEmpty(Password) || propertyName == "Role" && string.IsNullOrEmpty(Role) || propertyName == "Password1" && string.IsNullOrEmpty(Password1) || propertyName == "Profileid" && string.IsNullOrEmpty(Profileid)) info.ErrorText = String.Format("The '{0}' field cannot be empty", propertyName); }
/// <summary> /// Attempts to get a statfs struct for a given mount point. /// </summary> /// <param name="name">The drive name to retrieve the statfs data for.</param> /// <param name="data">The data retrieved from the mount point.</param> /// <returns>Returns true if data was filled with the results; otherwise, false.</returns> internal static bool TryGetStatFsForDriveName(string name, out statfs data, out ErrorInfo errorInfo) { data = default(statfs); if (get_statfs(name, out data) < 0) { errorInfo = Interop.Sys.GetLastErrorInfo(); return false; } errorInfo = default(ErrorInfo); return true; }
public void SplitData(object sender, DoWorkEventArgs e) { lock (thisLock) { ULStat = MccDaq.MccService.WinBufToArray(MemHandle, adData, 0, qChans * NumPoints); BoardErrorException.TestException(ULStat, this, "Reading the buffer"); DataEventArgs args = new DataEventArgs(); args.Data = adData; args.Board = Board; OnScanned(args); } }
public override void Append(ErrorInfo error) { if (error.Properties != null && error.Properties.Count > 0) { var pairs = new Dictionary<string, string>(); foreach (var key in error.Properties.Keys) { pairs.Add(key, error.Properties[key].ToString()); } error.AddDetail(this.Name, pairs); } }
public void AddWarningItem(ErrorInfo info) { int key = info.level; mSortedWarnningMap.Add(key, info); //reorder warning mWarnningList.Clear(); mWarnningList = mSortedWarnningMap.Values.ToList(); mWarnningList.Add(ERROEINFO_NORMAL); Warnning.write(info); }
public void LogException_ErrorInfo_Test() { // Arrange TestableElmahErrorHelper helper = new TestableElmahErrorHelper(); ErrorInfo info = new ErrorInfo(); // Act helper.LogException(info); // Assert Assert.NotNull(helper.Error); }
/// <summary> /// Gets an Exception to represent the supplied error info. /// </summary> /// <param name="error">The error info</param> /// <param name="path">The path with which this error is associated. This may be null.</param> /// <param name="isDirectory">true if the <paramref name="path"/> is known to be a directory; otherwise, false.</param> /// <returns></returns> internal static Exception GetExceptionForIoErrno(ErrorInfo errorInfo, string path = null, bool isDirectory = false) { switch (errorInfo.Error) { case Error.ENOENT: if (isDirectory) { return !string.IsNullOrEmpty(path) ? new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, path)) : new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName); } else { return !string.IsNullOrEmpty(path) ? new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, path), path) : new FileNotFoundException(SR.IO_FileNotFound); } case Error.EACCES: case Error.EBADF: case Error.EPERM: return !string.IsNullOrEmpty(path) ? new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, path)) : new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName); case Error.ENAMETOOLONG: return new PathTooLongException(SR.IO_PathTooLong); case Error.EWOULDBLOCK: return !string.IsNullOrEmpty(path) ? new IOException(SR.Format(SR.IO_SharingViolation_File, path), errorInfo.RawErrno) : new IOException(SR.IO_SharingViolation_NoFileName, errorInfo.RawErrno); case Error.ECANCELED: return new OperationCanceledException(); case Error.EFBIG: return new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_FileLengthTooBig); case Error.EEXIST: if (!string.IsNullOrEmpty(path)) { return new IOException(SR.Format(SR.IO_FileExists_Name, path), errorInfo.RawErrno); } goto default; default: return GetIOException(errorInfo); } }
public void Shoult_Append_Properties_Test() { // Arrange PropertiesAppender appender = new PropertiesAppender(); ErrorInfo error = new ErrorInfo(new Exception("Test-Exception")); error.Properties = new Dictionary<string, object>(); error.Properties.Add("Key", "Value"); // Act appender.Append(error); // Act Assert.Equal(error.ErrorDetails.Single().Name, appender.Name); }
public void BuildMessage_Appends_Details() { // Arrange ErrorInfo error = new ErrorInfo(new Exception()); var pair = new List<KeyValuePair<string, string>>(); pair.Add(new KeyValuePair<string, string>("Key", "Value")); error.AddDetail("Append Test", pair); // Act string detail = error.BuildMessage(); // Assert Assert.True(detail.Contains("Append Test")); }
public void AddDetail_Test() { // Arrange ErrorInfo error = new ErrorInfo(); error.AddDetail("Test", "Key", "Value"); // Act DetailInfo detail = error.ErrorDetails.First(); // Assert Assert.Equal("Test", detail.Name); Assert.Equal("Key", detail.Items[0].Key); Assert.Equal("Value", detail.Items[0].Value); }
public void GetPropertyError(string propertyName, ErrorInfo info) { switch (propertyName) { case "UnitName": if (string.IsNullOrEmpty(UnitName)) SetErrorInfo(info, "Tên đơn vị không được trống", ErrorType.Critical); if (IsNewObject) { var u = FindObject<Unit>(propertyName, UnitName); if (u != null) SetErrorInfo(info, "Tên đơn vị không được trùng", ErrorType.Critical); } break; } }
private string GetFileName(int id) { using (DataConnection connection = new DataConnection()) { string selectQuery = "SELECT fayl FROM kitobim_asar WHERE Id = @Id"; var param = new object[1, 3]; param[0, 0] = "Id"; param[0, 1] = id; ErrorInfo error = new ErrorInfo(); DataTable dataTable = connection.ExecuteDataTableQuery(selectQuery, param, QueryType.SqlQuery, error); if (error.Ok && dataTable != null && dataTable.Rows.Count > 0) { return dataTable.Rows[0][0].ToString(); } return string.Empty; } }
public override void Append(ErrorInfo errorInfo) { var pairs = new Dictionary<string, string>(); pairs.Add("ApplicationCurrentMemoryUsage", Utility.FormatBytes(DeviceStatus.ApplicationCurrentMemoryUsage)); pairs.Add("ApplicationMemoryUsageLimit", Utility.FormatBytes(DeviceStatus.ApplicationMemoryUsageLimit)); pairs.Add("ApplicationPeakMemoryUsage", Utility.FormatBytes(DeviceStatus.ApplicationPeakMemoryUsage)); pairs.Add("DeviceFirmwareVersion", DeviceStatus.DeviceFirmwareVersion); pairs.Add("DeviceHardwareVersion", DeviceStatus.DeviceHardwareVersion); pairs.Add("DeviceManufacturer", DeviceStatus.DeviceManufacturer); pairs.Add("DeviceName", DeviceStatus.DeviceName); pairs.Add("DeviceTotalMemory", Utility.FormatBytes(DeviceStatus.DeviceTotalMemory)); pairs.Add("IsKeyboardDeployed", DeviceStatus.IsKeyboardDeployed.ToString()); pairs.Add("IsKeyboardPresent", DeviceStatus.IsKeyboardPresent.ToString()); pairs.Add("PowerSource", DeviceStatus.PowerSource.ToString()); pairs.Add("DeviceType", Environment.DeviceType.ToString()); errorInfo.AddDetail(this.Name, pairs); }
public override bool Validate() { if (_hiddenSessionId.Value == null) return false; if (HttpContext.Current.Session[_hiddenSessionId.Value] == null || !_txtCaptcha.Text.ToLower().Equals(HttpContext.Current.Session[_hiddenSessionId.Value].ToString().ToLower())) { ErrorInfo error = new ErrorInfo(); error.Source = FieldName; string captchaMessage = GetResource(SiteConstants.CaptchaErrorMessage); if (string.IsNullOrEmpty(captchaMessage)) captchaMessage = "Incorrect captcha!"; error.Message = captchaMessage; RegisterError(error); return false; } return true; }
public void ValidateErrorInfo_Returns_True_Test() { // Arrange ErrorService service = new ErrorService(); ErrorInfo info = new ErrorInfo { ApplicationName = "ApplicationName", Host = "Host", Message = "Message", Detail = "Error" }; // Act bool result = service.ValidateErrorInfo(info); // Assert Assert.True(result); }
public void CreateDatabase(string databaseName, string dbFileSource, ErrorInfo error) { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.AppendFormat("CREATE DATABASE [{0}] ON PRIMARY ", databaseName); queryBuilder.Append("("); queryBuilder.AppendFormat("NAME = N'{0}', ", databaseName); queryBuilder.AppendFormat("FILENAME = N'{0}{1}.mdf', ", dbFileSource, databaseName); queryBuilder.Append("SIZE = 38912KB , "); queryBuilder.Append("MAXSIZE = UNLIMITED, "); queryBuilder.Append("FILEGROWTH = 1024KB )"); queryBuilder.Append("LOG ON "); queryBuilder.AppendFormat("( NAME = N'{0}_log', ", databaseName); queryBuilder.AppendFormat("FILENAME = N'{0}{1}.ldf' , ", dbFileSource, databaseName); queryBuilder.Append("SIZE = 112384KB , "); queryBuilder.Append("MAXSIZE = 2048GB , "); queryBuilder.Append("FILEGROWTH = 10%)"); _connection.ExecuteNonQuery(queryBuilder.ToString(), null, QueryType.SqlQuery, error); }
public void GetPropertyError(string propertyName, ErrorInfo info) { switch (propertyName) { case "MaLoaiDuoc": if (string.IsNullOrEmpty(MaLoaiDuoc)) SetErrorInfo(info, "Mã loại dược không được trống", ErrorType.Critical); if (IsNewObject) { if (FindObject<DM_LoaiDuoc>(propertyName, MaLoaiDuoc) != null) SetErrorInfo(info, "Mã nhóm dược không được trùng", ErrorType.Critical); } break; case "TenNhomDuoc": if (string.IsNullOrEmpty(TenLoaiDuoc)) SetErrorInfo(info, "Tên loại dược không được trống", ErrorType.Critical); break; } }
public static void AddError(ErrorInfo errorInfo) { try { _errorList.Add(errorInfo); var path = AppDomain.CurrentDomain.BaseDirectory + @"\" + "AppLog.txt"; using (var file = File.AppendText(@path)) { file.WriteLine(errorInfo.ErrorString); } } catch(Exception ex) { Console.WriteLine(ex); _errorList.Clear(); } }
/// <summary> /// Raises simple "HY000" error. /// </summary> private protected void HandleError(string message) => HandleError(ErrorInfo.Create(message));
private protected void HandleError(ErrorInfo error) { _lastError = error; PDO.HandleError(error); }
internal override bool ParseSingleElement(ICollection <XName> unprocessedElements, XElement elem) { if (elem.Name.LocalName == "Edmx") { if (!CheckForCorrectNamespace(elem, SchemaManager.GetEDMXNamespaceNames())) { return(false); } var runtimeElementProcessed = false; var designerElementProcessed = false; foreach (var elem2 in elem.Elements()) { if (elem2.Name.LocalName == "Runtime") { if (!CheckForCorrectNamespace(elem2, SchemaManager.GetEDMXNamespaceNames())) { continue; } if (runtimeElementProcessed) { var msg = String.Format(CultureInfo.CurrentCulture, Resources.DuplicatedElementMsg, elem2.Name.LocalName); var error = new ErrorInfo( ErrorInfo.Severity.ERROR, msg, this, ErrorCodes.DUPLICATED_ELEMENT_ENCOUNTERED, ErrorClass.ParseError); AddParseErrorForObject(this, error); continue; } runtimeElementProcessed = true; var conceptualModelsProcessed = false; var storageModelsProcessed = false; var mappingsProcessed = false; foreach (var elem3 in elem2.Elements()) { ParseSingleEntityModelElement( elem3, ref conceptualModelsProcessed, ref storageModelsProcessed, ref mappingsProcessed); } } else if (elem2.Name.LocalName == "Designer") { if (!CheckForCorrectNamespace(elem2, SchemaManager.GetEDMXNamespaceNames())) { continue; } if (designerElementProcessed) { var msg = String.Format(CultureInfo.CurrentCulture, Resources.DuplicatedElementMsg, elem2.Name.LocalName); var error = new ErrorInfo( ErrorInfo.Severity.ERROR, msg, this, ErrorCodes.DUPLICATED_ELEMENT_ENCOUNTERED, ErrorClass.ParseError); AddParseErrorForObject(this, error); continue; } designerElementProcessed = true; ParseDesignerInfoRoot(elem2); } else if (elem2.Name.LocalName == "DataServices") { if (!CheckForCorrectNamespace(elem2, SchemaManager.GetEDMXNamespaceNames())) { continue; } _dataServicesNodePresent = true; var error = new ErrorInfo( ErrorInfo.Severity.WARNING, Resources.DataServicesNodeWarning, this, ErrorCodes.DATA_SERVICES_NODE_DETECTED, ErrorClass.ParseError); AddParseErrorForObject(this, error); } else { var msg = String.Format(CultureInfo.CurrentCulture, Resources.UnexpectedElementMsg, elem2.Name.LocalName); var error = new ErrorInfo( ErrorInfo.Severity.ERROR, msg, this, ErrorCodes.UNEXPECTED_ELEMENT_ENCOUNTERED, ErrorClass.ParseError); AddParseErrorForObject(this, error); continue; } } return(true); } else { var msg = String.Format(CultureInfo.CurrentCulture, Resources.UnexpectedElementMsg, elem.Name.LocalName); var error = new ErrorInfo( ErrorInfo.Severity.ERROR, msg, this, ErrorCodes.UNEXPECTED_ELEMENT_ENCOUNTERED, ErrorClass.ParseError); AddParseErrorForObject(this, error); return(false); } }
public virtual void OnErrorInfo(ErrorInfo errorInfo) { }
private void _signTcpClient_Complated(object sender, MessageModel e) { if (e.MessageId == 0x03) { //返回错误 ErrorInfo erroInfo = JsonConvert.DeserializeObject <ErrorInfo>(e.Message); if (erroInfo != null) { MessageBoxEx.Show(erroInfo.Description, MessageBoxButton.OK); return; } } if (e.MessageId != Cmd) { return; } try { ReportResponse response = JsonConvert.DeserializeObject <ReportResponse>(e.Message); switch (response.ReportType) { case 0: CurrentTime = response.X.CurrentTime; TotalSlaes = response.X.TotalSales; TotalTax = response.X.TotalTax; TaxItems = response.X.TaxItems; InvoiceQuantity = response.X.InvoiceQuantity; break; case 1: CurrentTime = response.Z.CurrentTime; TotalSlaes = response.Z.TotalSales; TotalTax = response.Z.TotalTax; TaxItems = response.Z.TaxItems; InvoiceQuantity = response.Z.InvoiceQuantity; ReportNumber = response.Z.ReportNumber; BeginDate = response.Z.BeginDate; EndDate = response.Z.EndDate; break; case 2: CurrentTime = response.Periodic.CurrentTime; TotalSlaes = response.Periodic.TotalSales; TotalTax = response.Periodic.TotalTax; TaxItems = response.Periodic.TaxItems; InvoiceQuantity = response.Periodic.InvoiceQuantity; BeginDate = response.Periodic.BeginDate; EndDate = response.Periodic.EndDate; break; default: break; } //CurrentTime = "20180720213030"; //TotalSlaes = 300; //TotalTax = 200; //InvoiceQuantity = 2; //TaxItems = new List<Model.Service.Statistics.ReportTaxItems> //{ // new Model.Service.Statistics.ReportTaxItems // { // TaxLable="A", // TaxName="aaaaaaaaa", // TaxRate=0.12, // TaxAmount=1000 // }, // new Model.Service.Statistics.ReportTaxItems // { // TaxLable="A", // TaxName="aaaaaaaaa", // TaxRate=0.12, // TaxAmount=1000 // }, // new Model.Service.Statistics.ReportTaxItems // { // TaxLable="A", // TaxName="aaaaaaaaa", // TaxRate=0.12, // TaxAmount=1000 // }, // new Model.Service.Statistics.ReportTaxItems // { // TaxLable="A", // TaxName="aaaaaaaaa", // TaxRate=0.12, // TaxAmount=1000 // }, // new Model.Service.Statistics.ReportTaxItems // { // TaxLable="A", // TaxName="aaaaaaaaa", // TaxRate=0.12, // TaxAmount=1000 // }, // new Model.Service.Statistics.ReportTaxItems // { // TaxLable="B", // TaxName="bbbbbbbb", // TaxRate=0.12, // TaxAmount=500 // } //}; //ReportNumber = "111111"; //BeginDate = "20180715"; //EndDate = "20180720"; } catch (Exception ex) { _logger.Error(ex.Message); } }
internal void AddParseErrorForObject(EFObject obj, string errorMessage, int errorCode) { var ei = new ErrorInfo(ErrorInfo.Severity.ERROR, errorMessage, obj, errorCode, ErrorClass.ParseError); AddParseErrorForObject(obj, ei); }
private protected void ClearError() { _lastError = default; PDO.ClearError(); }
/// <summary> /// Update the internal state from a user parameter. /// </summary> /// <param name="updateErrorInfo">The possible <see cref="ErrorInfo"/> that was generated.</param> /// <param name="parameter">The user parameter.</param> /// <param name="mapper">The mapper to use.</param> public virtual void Update(out ErrorInfo updateErrorInfo, ref EffectInParameter parameter, PoolMapper mapper) { Debug.Assert(IsTypeValid(ref parameter)); updateErrorInfo = new ErrorInfo(); }
private void StopPump_Click(object sender, EventArgs e) { ErrorInfo info = StopPump(); HandleErrorMessage(info); }
public ServiceUnavailableException(ErrorInfo error) { _errors = new List <ErrorInfo> { error }; }
public override void Execute() { ErrorInfo info = ((ExceptionData)Model).Error; List <ExceptionInfo> errors = ((ExceptionData)Model).Infos; errors.Reverse(); int i = 0; WriteLiteral("\r\n<!DOCTYPE html>\r\n<html>\r\n<head>\r\n <title>程序出错了!</title>\r\n <meta"); WriteLiteral(" http-equiv=\"X-UA-Compatible\""); WriteLiteral(" content=\"IE=edge\""); WriteLiteral(" />\r\n <meta"); WriteLiteral(" http-equiv=\"Content-Type\""); WriteLiteral(" content=\"text/html; charset=utf-8\""); WriteLiteral(" />\r\n <meta"); WriteLiteral(" name=\"viewport\""); WriteLiteral(" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable" + "=0;\""); WriteLiteral(" />\r\n <link"); WriteLiteral(" rel=\"stylesheet\""); WriteLiteral(" type=\"text/css\""); WriteAttribute("href", Tuple.Create(" href=\"", 705), Tuple.Create("\"", 778) , Tuple.Create(Tuple.Create("", 712), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/bootstrap/css/bootstrap.min.css".AppVirutalPath() , 712), false) ); WriteLiteral(" />\r\n <link"); WriteLiteral(" rel=\"stylesheet\""); WriteLiteral(" type=\"text/css\""); WriteAttribute("href", Tuple.Create(" href=\"", 826), Tuple.Create("\"", 905) , Tuple.Create(Tuple.Create("", 833), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/bootstrap/css/bootstrap-theme.min.css".AppVirutalPath() , 833), false) ); WriteLiteral(" />\r\n</head>\r\n<body>\r\n <div"); WriteLiteral(" class=\"container\""); WriteLiteral(">\r\n <h2"); WriteLiteral(" class=\"text-danger\""); WriteLiteral(">“"); Write(info.Page); WriteLiteral("”出现错误。 </h2>\r\n <h2><small>"); Write(info.Url); WriteLiteral("</small></h2>\r\n <div"); WriteLiteral(" class=\"panel-group\""); WriteLiteral(" id=\"exceptionDetail\""); WriteLiteral(">\r\n"); foreach (ExceptionInfo error in errors) { string inClass = string.Empty; if (i == 0) { inClass = "in"; } string name = "error" + (++i); WriteLiteral(" <div"); WriteLiteral(" class=\"panel panel-default\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"panel-heading\""); WriteLiteral(">\r\n <h4"); WriteLiteral(" class=\"panel-title\""); WriteLiteral(">\r\n <a"); WriteLiteral(" data-toggle=\"collapse\""); WriteLiteral(" data-parent=\"#exceptionDetail\""); WriteAttribute("href", Tuple.Create(" href=\"", 1685), Tuple.Create("\"", 1705) , Tuple.Create(Tuple.Create("", 1692), Tuple.Create <System.Object, System.Int32>("#" + name , 1692), false) ); WriteLiteral(">"); Write(StringUtil.EscapeHtml(error.Message)); WriteLiteral("</a>\r\n </h4>\r\n </div>\r\n " + " <div"); WriteAttribute("id", Tuple.Create(" id=\"", 1833), Tuple.Create("\"", 1843) , Tuple.Create(Tuple.Create("", 1838), Tuple.Create <System.Object, System.Int32>(name , 1838), false) ); WriteAttribute("class", Tuple.Create(" class=\"", 1844), Tuple.Create("\"", 1908) , Tuple.Create(Tuple.Create("", 1852), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("panel-collapse collapse", inClass) , 1852), false) ); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"panel-body\""); WriteLiteral(">\r\n <dl"); WriteLiteral(" class=\"dl-horizontal\""); WriteLiteral(">\r\n <dt>例外类型</dt>\r\n " + " <dd>"); Write(error.Type); WriteLiteral("</dd>\r\n </dl>\r\n"); if (!string.IsNullOrEmpty(error.TargetSite)) { WriteLiteral(" <dl"); WriteLiteral(" class=\"dl-horizontal\""); WriteLiteral(">\r\n <dt>TargetSite</dt>\r\n " + " <dd>"); Write(StringUtil.EscapeHtml(error.TargetSite)); WriteLiteral("</dd>\r\n </dl>\r\n"); } WriteLiteral(" <dl"); WriteLiteral(" class=\"dl-horizontal\""); WriteLiteral(">\r\n <dt>错误源</dt>\r\n " + "<dd>"); Write(error.ErrorSource + ".dll"); WriteLiteral("</dd>\r\n </dl>\r\n"); if (!string.IsNullOrEmpty(error.ErrorObj)) { WriteLiteral(" <dl"); WriteLiteral(" class=\"dl-horizontal\""); WriteLiteral(">\r\n <dt>错误对象</dt>\r\n " + " <dd>"); Write(StringUtil.EscapeHtml(error.ErrorObj)); WriteLiteral("</dd>\r\n </dl>\r\n"); WriteLiteral(" <dl"); WriteLiteral(" class=\"dl-horizontal\""); WriteLiteral(">\r\n <dt>错误对象类型</dt>\r\n " + " <dd>"); Write(StringUtil.EscapeHtml(error.ErrorObjType)); WriteLiteral("</dd>\r\n </dl>\r\n"); } WriteLiteral(" "); if (!string.IsNullOrEmpty(error.Argument)) { WriteLiteral(" <dl"); WriteLiteral(" class=\"dl-horizontal\""); WriteLiteral(">\r\n <dt>函数参数</dt>\r\n " + " <dd>"); Write(StringUtil.EscapeHtml(error.Argument)); WriteLiteral("</dd>\r\n </dl>\r\n"); } WriteLiteral(" "); if (error.OtherInfos.Count > 0) { foreach (KeyValuePair <string, string> pair in error.OtherInfos) { WriteLiteral(" <dl"); WriteLiteral(" class=\"dl-horizontal\""); WriteLiteral(">\r\n <dt>"); Write(pair.Key); WriteLiteral("</dt>\r\n <dd><pre>"); Write(StringUtil.EscapeHtml(pair.Value)); WriteLiteral("</pre></dd>\r\n </dl>\r\n"); } } WriteLiteral(" <pre>"); Write(StringUtil.EscapeHtml(error.StackTrace)); WriteLiteral("</pre>\r\n </div>\r\n </div>\r\n " + " </div>\r\n"); } WriteLiteral(" </div>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 4514), Tuple.Create("\"", 4579) , Tuple.Create(Tuple.Create("", 4520), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/lib/jquery-1.11.1.min.js".AppVirutalPath() , 4520), false) ); WriteLiteral("></script>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 4630), Tuple.Create("\"", 4700) , Tuple.Create(Tuple.Create("", 4636), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/bootstrap/js/bootstrap.min.js".AppVirutalPath() , 4636), false) ); WriteLiteral("></script>\r\n</body>\r\n</html>\r\n"); }