Пример #1
0
 private static void PopulateErrorFromZeusExecError(MyGenError error, IZeusExecutionError zee)
 {
     error.columnNumber = zee.Column;
     error.SourceFile   = zee.FileName;
     error.isRuntime    = zee.IsRuntime;
     error.IsWarning    = zee.IsWarning;
     error.lineNumber   = zee.Line;
     error.message      = zee.Message;
     error.ErrorNumber  = zee.Number;
     error.SourceLine   = zee.Source;
     error.detail       = zee.StackTrace;
 }
Пример #2
0
        public void SetControlsFromException()
        {
            lineNumber = -1;
            isTemplate = true;

            lastErrors.Clear();

            if (exception is ZeusExecutionException)
            {
                ZeusExecutionException executionException = exception as ZeusExecutionException;

                int numErrors = executionException.Errors.Length;
                if (numErrors > 1)
                {
                    this.panelErrors.Visible = true;
                    this._max = executionException.Errors.Length - 1;
                    this.UpdateErrorLabel();
                }
                else
                {
                    this.panelErrors.Visible = false;
                }

                this.labelFile.Text            = "Template Filename";
                this.labelTitle.Text           = "Scripting Error";
                this.labelSource.Text          = "Source";
                this.labelMessage.Text         = "Error Text";
                this.labelMethod.Text          = "Error Number";
                this.labelStackTrace.Text      = "Scripting Errors and Warnings:";
                this.textBoxExceptionType.Text = "Scripting Error";

                IZeusExecutionError error = executionException.Errors[this._index];

                if (!error.IsWarning)
                {
                    this.textBoxFile.Text    = error.FileName;
                    this.textBoxLine.Text    = error.Line.ToString();
                    this.textBoxColumn.Text  = error.Column.ToString();
                    this.textBoxSource.Text  = error.Source;
                    this.textBoxMessage.Text = error.Message + " " + error.Description;
                    this.textBoxMethod.Text  = error.Number;

                    this.lastFileName = error.FileName;
                    this.lineNumber   = error.Line;
                }

                foreach (IZeusExecutionError tmperror in executionException.Errors)
                {
                    // Create error string for the log
                    StringBuilder builder = new StringBuilder();
                    builder.Append(tmperror.IsWarning ? "[Warning] " : "[Error] ");
                    builder.Append(tmperror.Source);
                    builder.Append(" (" + tmperror.Line + ", " + tmperror.Column + ") ");
                    builder.Append(tmperror.Number + ": ");
                    builder.Append(tmperror.Message);

                    if (tmperror.StackTrace != string.Empty)
                    {
                        builder.Append("\r\nStack Trace");
                        builder.Append(tmperror.StackTrace);
                    }

                    if (tmperror == error)
                    {
                        this.textBoxStackTrace.Text = builder.ToString();
                    }

                    lastErrors.Add(builder.ToString());
                }

                isTemplate = executionException.IsTemplateScript;
            }
            else if (exception is ZeusDynamicException)
            {
                ZeusDynamicException zde = exception as ZeusDynamicException;

                this.textBoxFile.Text   = string.Empty;
                this.textBoxLine.Text   = string.Empty;
                this.textBoxColumn.Text = string.Empty;

                this.textBoxSource.Text        = string.Empty;
                this.textBoxMessage.Text       = zde.Message;
                this.textBoxMethod.Text        = string.Empty;
                this.textBoxStackTrace.Text    = string.Empty;
                this.textBoxExceptionType.Text = zde.GetType().Name;

                this.labelTitle.Text  = zde.DynamicExceptionTypeString;
                this.labelMethod.Text = string.Empty;

                // Create error string for the log
                lastErrors.Add("[" + this.textBoxExceptionType.Text + "] " + zde.DynamicExceptionTypeString + " - " + zde.Message);
            }
            else
            {
                StackTrace stackTrace = null;
                StackFrame stackFrame = null;

                Exception baseException = exception.GetBaseException();

                try
                {
                    stackTrace = new StackTrace(baseException, true);

                    if (stackTrace.FrameCount > 0)
                    {
                        stackFrame = stackTrace.GetFrame(stackTrace.FrameCount - 1);
                    }
                }
                catch
                {
                    stackTrace = null;
                }

                if (stackFrame != null)
                {
                    this.textBoxFile.Text   = stackFrame.GetFileName();
                    this.textBoxLine.Text   = stackFrame.GetFileLineNumber().ToString();
                    this.textBoxColumn.Text = stackFrame.GetFileColumnNumber().ToString();
                }

                this.textBoxSource.Text        = baseException.Source;
                this.textBoxMessage.Text       = baseException.Message;
                this.textBoxMethod.Text        = baseException.TargetSite.ToString();
                this.textBoxStackTrace.Text    = baseException.StackTrace;
                this.textBoxExceptionType.Text = baseException.GetType().Name;

                this.labelTitle.Text  = "System Exception";
                this.labelMethod.Text = "Method";

                // Create error string for the log
                lastErrors.Add("[" + this.textBoxExceptionType.Text + "] " + this.textBoxSource.Text +
                               "(" + this.textBoxLine.Text + ", " + this.textBoxColumn.Text + ") " +
                               this.textBoxMessage.Text);
            }
        }
Пример #3
0
 private static void PopulateErrorFromZeusExecError(MyGenError error, IZeusExecutionError zee)
 {
     error.columnNumber = zee.Column;
     error.SourceFile = zee.FileName;
     error.isRuntime = zee.IsRuntime;
     error.IsWarning = zee.IsWarning;
     error.lineNumber = zee.Line;
     error.message = zee.Message;
     error.ErrorNumber = zee.Number;
     error.SourceLine = zee.Source;
     error.detail = zee.StackTrace;
 }
        public ZeusExecutionException(IZeusTemplate template, IZeusExecutionError[] errors, bool isTemplateScript)
            : base(template, "Template Execution Error")
		{
			this._errors = errors;
			this._isTemplateScript = isTemplateScript;
		}