private void UpdateExpanded() { if (_expanded) { _detailButton.Text = Strings.CLessDetails; _exceptionMessage.WordWrap = false; } else { _detailButton.Text = Strings.CMoreDetails; _exceptionMessage.WordWrap = true; } if (_exception != null) { if (_expanded) { _exceptionMessage.Text = ExceptionUtility.DetailedDescription(_exception); } else { _exceptionMessage.Text = ExceptionUtility.BriefDescription(_exception); } } else { _exceptionMessage.Text = String.Empty; } UpdateSize(); }
public override object InternalExecute(Program program, object argument1) { #if NILPROPOGATION if (argument1 == null) { return(null); } #endif return(ExceptionUtility.BriefDescription((Exception)argument1)); }
public static void RenderError(HtmlTextWriter writer, Exception exception) { if (!(exception is AbortException)) { // Render hidden verbose error writer.AddAttribute(HtmlTextWriterAttribute.Style, "display: none;"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Class, "error"); writer.RenderBeginTag(HtmlTextWriterTag.Font); writer.RenderBeginTag(HtmlTextWriterTag.Pre); writer.Write(HttpUtility.HtmlEncode(ExceptionUtility.DetailedDescription(exception))); writer.RenderEndTag(); writer.RenderEndTag(); // FONT writer.RenderEndTag(); // DIV // Render visible concise error writer.AddAttribute(HtmlTextWriterAttribute.Border, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); writer.RenderBeginTag(HtmlTextWriterTag.Table); writer.RenderBeginTag(HtmlTextWriterTag.Tr); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.AddAttribute(HtmlTextWriterAttribute.Class, "error"); writer.RenderBeginTag(HtmlTextWriterTag.Font); writer.RenderBeginTag(HtmlTextWriterTag.Pre); writer.Write(HttpUtility.HtmlEncode(ExceptionUtility.BriefDescription(exception))); writer.RenderEndTag(); writer.RenderEndTag(); // FONT writer.RenderEndTag(); // TD writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.AddAttribute(HtmlTextWriterAttribute.Type, "button"); writer.AddAttribute(HtmlTextWriterAttribute.Class, "button"); writer.AddAttribute(HtmlTextWriterAttribute.Value, Strings.Get("ErrorDetailsButtonText"), true); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "ShowErrorDetail(GetParentTable(this))"); writer.RenderBeginTag(HtmlTextWriterTag.Input); writer.RenderEndTag(); writer.RenderEndTag(); // TD writer.RenderEndTag(); // TR writer.RenderEndTag(); // TABLE } }
private void InternalAppendError(IErrorSource source, Exception exception, bool warning) { if (exception != null) { ListViewItem item = new ListViewItem(); item.Tag = new ErrorItem(exception, source); item.ImageIndex = (warning ? 0 : 1); // if this is a DataphorException add the exception code to the description DataphorException localException = exception as DataphorException; item.SubItems.Add(String.Format("{0}{1}", localException != null ? String.Format("({0}:{1}) ", localException.Severity.ToString(), localException.Code.ToString()) : "", ExceptionUtility.BriefDescription(exception))); item.SubItems.Add(exception.GetType().ToString()); _errorListView.Items.Insert(0, item); if ((source != null) && (_errorSources[source] == null)) { _errorSources.Add(source, source); source.Disposed += new EventHandler(ErrorSourceDisposed); } } }
public override int ExecuteNonQuery() { Prepare(); try { if (_plan == null) { _plan = _connection.ServerProcess.PrepareStatement(PreparedCommandText, _dAERuntimeParams); } } catch (Exception AException) { throw new Exception(String.Format("Error preparing statement {0}. Details ({1})", PreparedCommandText, ExceptionUtility.BriefDescription(AException)), AException); } try { ((IServerStatementPlan)_plan).Execute(_dAERuntimeParams); } catch (Exception AException) { throw new Exception(String.Format("Error Executing statement {0}. Details ({1})", PreparedCommandText, ExceptionUtility.BriefDescription(AException)), AException); } _parameters.UpdateParams(_dAERuntimeParams); return(0); // Return 0 because Dataphor doesn't report modified rows }
/// <summary>Logs exceptions thrown by the server</summary> public static void LogException(Exception exception) { System.Diagnostics.EventLog.WriteEntry(ServiceUtility.EventLogSource, ExceptionUtility.BriefDescription(exception), EventLogEntryType.Error); }