public static void ExceptionHandle(System.Web.UI.Page i_page, Exception ip_e, decimal ip_dc_user) { string v_str_message_error = ""; try { Initialize(); switch (m_runmode) { case RUN_MODE.DEVELOP: v_str_message_error = "Lỗi: " + ip_e.Message + "\n Trace: " + ip_e.StackTrace; break; case RUN_MODE.RELEASE: v_str_message_error = "Đã xảy ra lỗi trong quá trình xử lý hệ thống!"; break; default: v_str_message_error = "Đã xảy ra lỗi trong quá trình xử lý hệ thống!"; break; } HelpUtils.ghi_log_he_thong(LOG_TRUY_CAP.LOI_HE_THONG, "Exception", v_str_message_error, "", ip_dc_user); i_page.Response.Redirect("MessageError.aspx?Message= Error:" + v_str_message_error); } catch (Exception) { HelpUtils.ghi_log_he_thong(LOG_TRUY_CAP.LOI_HE_THONG, "Exception", ip_e.Message, ip_e.StackTrace, ip_dc_user); } }
void HandleOrRethrowException(Exception e) { Exception currentException = e; while (currentException != null) { if (currentException is SocketException) { SocketException socketException = (SocketException)currentException; if (IsWouldBlockException(socketException)) { // Workaround for WSAEWOULDBLOCK socket.Blocking= true; // return to give the caller possibility to retry the call return; } else if (IsTimeoutException(socketException)) { throw new TimeoutException(socketException.Message, e); } } currentException = currentException.InnerException; } throw (e); }
internal GridViewUpdatedEventArgs (int affectedRows, Exception e, IOrderedDictionary keys, IOrderedDictionary oldValues, IOrderedDictionary newValues) : this (affectedRows, e) { this.keys = keys; this.newValues = newValues; this.oldValues = oldValues; }
/// <summary> /// Constructor. /// </summary> /// <param name="page">The DocumentPage object for the requesed Page.</param> /// <param name="pageNumber">The page number of the returned page.</param> /// <param name="error">Error occurred during an asynchronous operation.</param> /// <param name="cancelled">Whether an asynchronous operation has been cancelled.</param> /// <param name="userState">Unique identifier for the asynchronous task.</param> public GetPageCompletedEventArgs(DocumentPage page, int pageNumber, Exception error, bool cancelled, object userState) : base(error, cancelled, userState) { _page = page; _pageNumber = pageNumber; }
public static void LogException(string message, Exception ex) { var logger = log4net.LogManager.GetLogger(LOGGER_NAME); if (logger == null) return; logger.Error(message, ex); }
public DetailsViewInsertedEventArgs (int affectedRows, Exception e) { this.rowsAffected = affectedRows; this.e = e; this.exceptionHandled = false; this.keepInsertedMode = false; }
public GridViewUpdatedEventArgs (int affectedRows, Exception e) { this.rowsAffected = affectedRows; this.e = e; this.exceptionHandled = false; this.keepEditMode = false; }
public SqlDataSourceStatusEventArgs (DbCommand command, int rowsAffected, Exception exception) { this.command = command; this.rowsAffected = rowsAffected; this.exception = exception; this.exceptionHandled = false; }
/// <summary> /// Constructor. /// </summary> /// <param name="contentPosition">The parameter passed into the GetPageNumberAsync call.</param> /// <param name="pageNumber">The first page number on which the element appears.</param> /// <param name="error">Error occurred during an asynchronous operation.</param> /// <param name="cancelled">Whether an asynchronous operation has been cancelled.</param> /// <param name="userState">Unique identifier for the asynchronous task.</param> public GetPageNumberCompletedEventArgs(ContentPosition contentPosition, int pageNumber, Exception error, bool cancelled, object userState) : base(error, cancelled, userState) { _contentPosition = contentPosition; _pageNumber = pageNumber; }
/// <summary> /// 构建一个 InvalidCsvFieldException 对象实例 /// </summary> /// <param name="properyName">属性名称</param> /// <param name="fieldName">csv字段名称</param> /// <param name="fieldValue">csv字段值</param> /// <param name="innerException">字段赋值失败的实际异常实例</param> public InvalidCsvFieldException(String properyName, String fieldName, String fieldValue, Exception innerException) : base( String.Format("propertyName={0}, fieldName={1}, fieldValue={2}, 无效的 csv 字段配置。", properyName, fieldName, fieldValue), innerException) { }
/// <summary>Throws the exception on the thread pool.</summary> /// <param name="exception">The exception to propagate.</param> /// <param name="targetContext"> /// The target context on which to propagate the exception; otherwise, <see langword="null"/> to use the thread /// pool. /// </param> internal static void ThrowAsync(Exception exception, SynchronizationContext targetContext) { if (targetContext != null) { try { targetContext.Post( state => { throw PrepareExceptionForRethrow((Exception)state); }, exception); return; } catch (Exception ex) { exception = new AggregateException(exception, ex); } } #if NET45PLUS Task.Run(() => { throw PrepareExceptionForRethrow(exception); }); #else ThreadPool.QueueUserWorkItem(state => { throw PrepareExceptionForRethrow((Exception)state); }, exception); #endif }
public virtual void addFailure(Exception targetException) { if (targetException is MultipleFailureException) this.addMultipleFailureException((MultipleFailureException) targetException); else this.fNotifier.fireTestFailure(new Failure(this.fDescription, targetException)); }
public static void LogExceptionsBulkUpload(Exception Ex, string Page, string method) { string _SchLogs = System.Configuration.ConfigurationSettings.AppSettings["ServiceLogFolder"].ToString() + "Bulk_Exceptions.txt"; StringBuilder _BuilderException = new StringBuilder(); _BuilderException.Append("***********************************" + DateTime.Now.ToString() + "***********************************"); _BuilderException.AppendLine(); _BuilderException.Append(Ex.Message.ToString()); _BuilderException.AppendLine(); _BuilderException.AppendLine(); //page _BuilderException.Append("Page :" + Page); _BuilderException.AppendLine(); _BuilderException.AppendLine(); //mehotd _BuilderException.Append("Method :" + method); _BuilderException.AppendLine(); if (Ex.InnerException != null) { _BuilderException.AppendLine(); _BuilderException.Append(Ex.InnerException.ToString()); _BuilderException.AppendLine(); _BuilderException.Append(Ex.Message.ToString()); _BuilderException.AppendLine(); } _BuilderException.Append("*****************************************************************************************************"); StreamWriter _Sche_Log = new StreamWriter(_SchLogs, true, Encoding.Default); _Sche_Log.WriteLine(_BuilderException); _Sche_Log.Close(); }
internal virtual void Abort(Exception e) { if (GlobalLog.IsEnabled) { GlobalLog.Print("CommandStream" + LoggingHash.HashString(this) + "::Abort() - closing control Stream"); } lock (this) { if (_aborted) return; _aborted = true; } try { base.Close(0); } finally { if (e != null) { InvokeRequestCallback(e); } else { InvokeRequestCallback(null); } } }
internal JsonException (ParserToken token, Exception inner_exception) : base (String.Format ( "Invalid token '{0}' in input string", token), inner_exception) { }
public RunWorkerCompletedEventArgs(object result, Exception error, bool cancelled) : base(error, cancelled, null) { this.result = result; }
public void DebugMessage(Exception exception) { if (exception == null) return; DebugMessage(GetExceptionString(exception)); }
internal static bool HandleTransportExceptionHelper(Exception exception) { if (exception == null) { throw Fx.AssertAndThrow("Null exception passed to HandleTransportExceptionHelper."); } ExceptionHandler handler = TransportExceptionHandler; if (handler == null) { return false; } try { if (!handler.HandleException(exception)) { return false; } } catch (Exception thrownException) { if (Fx.IsFatal(thrownException)) { throw; } DiagnosticUtility.TraceHandledException(thrownException, TraceEventType.Error); return false; } DiagnosticUtility.TraceHandledException(exception, TraceEventType.Error); return true; }
public DataServiceException (int statusCode, string errorCode, string message, string messageXmlLang, Exception innerException) : base (message, innerException) { this.StatusCode = statusCode; this.ErrorCode = errorCode; this.MessageLanguage = messageXmlLang; }
protected void AddMessage(string Message, string Type, Exception ex = null) { if (Type == "Error") { Exceptions.LogException(ex); if (UserInfo.IsSuperUser) { Skin.AddModuleMessage(this, Message, ModuleMessage.ModuleMessageType.RedError); } else { Skin.AddModuleMessage(this, Localization.GetString("msgError.Text", this.LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } else if (Type == "Success") { Skin.AddModuleMessage(this, Message, ModuleMessage.ModuleMessageType.GreenSuccess); } else if (Type == "Warning") { Skin.AddModuleMessage(this, Message, ModuleMessage.ModuleMessageType.YellowWarning); } else if (Type == "Information") { Skin.AddModuleMessage(this, Message, ModuleMessage.ModuleMessageType.BlueInfo); } }
public static void CtorTest(Exception expectedException, bool expectedCancelled, object expectedState) { var target = new AsyncCompletedEventArgsTests(expectedException, expectedCancelled, expectedState); Assert.Equal(expectedException, target.Error); Assert.Equal(expectedCancelled, target.Cancelled); Assert.Equal(expectedState, target.UserState); }
public ObjectDataSourceStatusEventArgs (object returnVal, IDictionary outPutParam) { this.returnVal = returnVal; this.outPutParam = outPutParam; this.exception = null; this.exceptionHandled = false; }
public DataView ExceltoDataView(string strFilePath) { DataView dv; try { OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + strFilePath + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'"); conn.Open(); object[] CSs0s0001 = new object[4]; CSs0s0001[3] = "TABLE"; DataTable tblSchema = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, CSs0s0001); string tableName = Convert.ToString(tblSchema.Rows[0]["TABLE_NAME"]); if (tblSchema.Rows.Count > 1) { tableName = "sheet1$"; } string sql_F = "SELECT * FROM [{0}]"; OleDbDataAdapter adp = new OleDbDataAdapter(string.Format(sql_F, tableName), conn); DataSet ds = new DataSet(); adp.Fill(ds, "Excel"); dv = ds.Tables[0].DefaultView; conn.Close(); } catch (Exception) { Exception strEx = new Exception("請確認是否使用模板上傳(上傳的Excel中第一個工作表名稱是否為Sheet1)"); throw strEx; } return dv; }
private static void HandleException(Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex); Console.ReadKey(); Environment.Exit(0); }
public void ThrowWithData() { Exception e = new Exception(msg1); e.Data[key1] = val1; e.Data[key2] = val2; throw (e); }
/// <summary> /// Retrieves the value of a property. That property can be nested. /// Each element of the path needs to be a public instance property. /// </summary> /// <param name="item">Object that exposes the property</param> /// <param name="propertyPath">Property path</param> /// <param name="exception">Potential exception</param> /// <returns>Property value</returns> internal static object GetNestedPropertyValue(object item, string propertyPath, out Exception exception) { Debug.Assert(item != null, "Unexpected null item in TypeHelper.GetNestedPropertyValue"); object value = null; exception = GetOrSetNestedPropertyValue(false /*set*/, item, ref value, propertyPath); return value; }
/// <summary> /// Retrieves the value of a property. That property can be nested. /// Each element of the path needs to be a public instance property. /// </summary> /// <param name="item">Object that exposes the property</param> /// <param name="propertyPath">Property path</param> /// <param name="propertyType">Property type</param> /// <param name="exception">Potential exception</param> /// <returns>Property value</returns> internal static object GetNestedPropertyValue(object item, string propertyPath, Type propertyType, out Exception exception) { exception = null; // if the propertyPath is null or empty, use the // item directly if (String.IsNullOrEmpty(propertyPath)) { return item; } string[] propertyNames = propertyPath.Split(PropertyNameSeparator); for (int i = 0; i < propertyNames.Length; i++) { if (item == null) { break; } Type type = item.GetType(); // if we can't find the property or it is not of the correct type, // treat it as a null value PropertyInfo propertyInfo = type.GetProperty(propertyNames[i]); if (propertyInfo == null) { break; } if (!propertyInfo.CanRead) { exception = new InvalidOperationException(string.Format( System.Globalization.CultureInfo.InvariantCulture, CommonResources.PropertyNotReadable, propertyNames[i], type.GetTypeName())); break; } if (i == propertyNames.Length - 1) { // if the property type did not match, return null if (propertyInfo.PropertyType != propertyType) { break; } else { return propertyInfo.GetValue(item, null); } } else { item = propertyInfo.GetValue(item, null); } } return null; }
public ParseFileException(string message, string fileName, long? lineNumber, Exception causeException) : base(message, causeException) { this.fileName = fileName; this.lineNumber = lineNumber; }
public void OnException(Exception e) { if (_errorCallback != null) _errorCallback(e); else Debug.Log(e.Message); }
public ObjectDataSourceStatusEventArgs (object returnVal, IDictionary outPutParam, Exception e) { this.returnVal = returnVal; this.outPutParam = outPutParam; this.exception = e; this.exceptionHandled = true; }
public ServiceConfigurationError(string message, Exception innerException) : base(message, innerException) { }
public PersistenceUnavailableException(Exception innerException) : base("Exception occurred.", innerException) { }
public void LogFailure(NpgsqlCommand command, Exception ex) { Console.WriteLine("Postgresql command failed!"); Console.WriteLine(command.CommandText); Console.WriteLine(ex); }
public void LogFailure(NpgsqlCommand command, Exception ex) { }
private ServiceConfigurationError(Exception cause, bool privateOverload) : base(cause?.ToString(), cause) { }
private ServiceConfigurationError(string message, Exception innerException, bool privateOverload) : base(message, innerException) { }
public ServiceConfigurationError(Exception cause) : base(cause?.ToString(), cause) { }
public static Exception Create(string message, Exception innerException) => new ServiceConfigurationError(message, innerException, privateOverload: true);
public GetDevicesCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; }
public static Exception Create(Exception cause) => new ServiceConfigurationError(cause.Message, cause, privateOverload: true);
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { }
/// <summary> /// Called to trigger <see cref="Failed"/> event. /// </summary> /// <param name="exception">Exception that cause failure</param> protected virtual void OnFailed(Exception exception) { Failed.InvokeSafely(this, new UnitOfWorkFailedEventArgs(exception)); }
/// <summary> /// Construct instance of SourceNotFoundException /// </summary> /// <param name="innerException"></param> public SourceNotFoundException(Exception innerException) : base(innerException) { }
public void OnError(Exception error) { }
/// <summary> /// Initialises a new instance of the <c>ErrorResponseException</c> class. /// </summary> /// <param name="message">The error message that explains the reason for the exception.</param> /// <param name="innerException">The exception that is the cause of the current exception. If the innerException parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception.</param> /// <param name="error"><c>ErrorResponse</c> object.</param> public ErrorResponseException(string message, Exception innerException, ErrorResponse error) : base(message, innerException) { this.Error = error; }
/// <summary> /// Construct instance of SourceNotFoundException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public SourceNotFoundException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, innerException, errorType, errorCode, requestId, statusCode) { }
public AHGOVException(string message, Exception inner) : base(message, inner) { }
/// <summary> /// Construct instance of SourceNotFoundException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> public SourceNotFoundException(string message, Exception innerException) : base(message, innerException) { }
protected override void ProcessRecord() { this.ResolvePath(); long res = 0; if (!this._queryInitialized) { if (this._format.ToLower(CultureInfo.InvariantCulture).Equals("blg")) { res = this._pdhHelper.AddRelogCounters(this._counterSampleSets[0]); } else { res = this._pdhHelper.AddRelogCountersPreservingPaths(this._counterSampleSets[0]); } if (res != 0) { this.ReportPdhError(res, true); } res = this._pdhHelper.OpenLogForWriting(this._resolvedPath, this._outputFormat, this.Force.IsPresent, (this._maxSize * 0x400) * 0x400, this.Circular.IsPresent, null); if (res == 0xc0000bd2L) { Exception exception = new Exception(string.Format(CultureInfo.InvariantCulture, this._resourceMgr.GetString("CounterFileExists"), new object[] { this._resolvedPath })); base.ThrowTerminatingError(new ErrorRecord(exception, "CounterFileExists", ErrorCategory.InvalidResult, null)); } else if (res == 0xc0000bc9L) { Exception exception2 = new Exception(string.Format(CultureInfo.InvariantCulture, this._resourceMgr.GetString("FileCreateFailed"), new object[] { this._resolvedPath })); base.ThrowTerminatingError(new ErrorRecord(exception2, "FileCreateFailed", ErrorCategory.InvalidResult, null)); } else if (res == 0xc0000bcaL) { Exception exception3 = new Exception(string.Format(CultureInfo.InvariantCulture, this._resourceMgr.GetString("FileOpenFailed"), new object[] { this._resolvedPath })); base.ThrowTerminatingError(new ErrorRecord(exception3, "FileOpenFailed", ErrorCategory.InvalidResult, null)); } else if (res != 0) { this.ReportPdhError(res, true); } this._queryInitialized = true; } foreach (PerformanceCounterSampleSet set in this._counterSampleSets) { this._pdhHelper.ResetRelogValues(); foreach (PerformanceCounterSample sample in set.CounterSamples) { bool bUnknownPath = false; res = this._pdhHelper.SetCounterValue(sample, out bUnknownPath); if (bUnknownPath) { Exception exception4 = new Exception(string.Format(CultureInfo.InvariantCulture, this._resourceMgr.GetString("CounterExportSampleNotInInitialSet"), new object[] { sample.Path, this._resolvedPath })); base.WriteError(new ErrorRecord(exception4, "CounterExportSampleNotInInitialSet", ErrorCategory.InvalidResult, null)); } else if (res != 0) { this.ReportPdhError(res, true); } } res = this._pdhHelper.WriteRelogSample(set.Timestamp); if (res != 0) { this.ReportPdhError(res, true); } if (this._stopping) { return; } } }
public ManagedAppException(string message, Exception inner) : base(message, inner) { }
/// <summary> /// Construct instance of ProjectNotFoundException /// </summary> /// <param name="innerException"></param> public ProjectNotFoundException(Exception innerException) : base(innerException) {}
public NoMediaException(string message, Exception inner) : base(message, inner) { }
public string Log(Exception ex) { BuildMessage(ex); return SaveLog(); }
public void WriteError(Exception error, string format, params object[] args) { WriteError(error, string.Format(format, args)); }
public ZCopyException(string message, Exception innerException = default) : base(message, innerException) { }
/// <summary> /// Construct instance of ProjectNotFoundException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> public ProjectNotFoundException(string message, Exception innerException) : base(message, innerException) {}
public void Error(Exception ex) { Errors.Add(ex); }
private void BuildMessage(Exception ex) { _text = new Text(); _text.BuildExceptionMessage(ex, false); }
public DisconnectedException(string message, Exception innerException) : base(message, innerException) { }
/// <summary> /// Initializes a new instance of the <see cref="InvalidPasswordException" /> class. /// </summary> /// <param name="message">The error message that explains the reason for the exception.</param> /// <param name="innerException"> /// The exception that is the cause of the current exception. If the /// <paramref name="innerException" /> parameter is not a null reference, the current exception is raised in a catch /// block that handles the inner exception. /// </param> public InvalidPasswordException(string message, Exception innerException) : base(message, innerException) { }