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 static void PopulateErrorFromException(MyGenError error, Exception ex) { StringBuilder sb = new StringBuilder(); error.errorType = ex.GetType().Name; error.message = ex.Message; error.detail = ex.StackTrace; error.SourceFile = ex.Source; StackTrace st = new StackTrace(ex); StackFrame[] sfs = st.GetFrames(); foreach (StackFrame sf in sfs) { error.lineNumber = sf.GetFileLineNumber(); error.ColumnNumber = sf.GetFileColumnNumber(); error.SourceFile = sf.GetFileName(); error.SourceLine = sf.GetMethod().Name; break; } }
public static List<IMyGenError> CreateErrors(params Exception[] exceptions) { MyGenError error; List<IMyGenError> myGenErrors = new List<IMyGenError>(); foreach (Exception loopex in exceptions) { Exception ex = loopex, bex = ex.GetBaseException(); if (ex is ZeusRuntimeException) { ZeusRuntimeException zrex = ex as ZeusRuntimeException; if (bex is ZeusExecutionException) { ZeusExecutionException zeex = bex as ZeusExecutionException; foreach (IZeusExecutionError zee in zeex.Errors) { error = new MyGenError(); error.errorClass = MyGenErrorClass.Template; error.templateFileName = zrex.Template.FilePath + zrex.Template.FileName; error.TemplateIdentifier = zrex.Template.UniqueID; error.IsTemplateCodeSegment = zrex.IsTemplateScript; PopulateErrorFromZeusExecError(error, zee); myGenErrors.Add(error); } } else { error = new MyGenError(); error.errorClass = MyGenErrorClass.Template; error.templateFileName = zrex.Template.FilePath + zrex.Template.FileName; error.TemplateIdentifier = zrex.Template.UniqueID; error.IsTemplateCodeSegment = zrex.IsTemplateScript; error.isRuntime = true; PopulateErrorFromException(error, bex); myGenErrors.Add(error); } } else if (ex is ZeusExecutionException) { ZeusExecutionException zeex = ex as ZeusExecutionException; foreach (IZeusExecutionError zee in zeex.Errors) { error = new MyGenError(); error.errorClass = MyGenErrorClass.Template; error.templateFileName = zeex.Template.FilePath + zeex.Template.FileName; error.TemplateIdentifier = zeex.Template.UniqueID; error.IsTemplateCodeSegment = zeex.IsTemplateScript; PopulateErrorFromZeusExecError(error, zee); myGenErrors.Add(error); } } else { if (bex == null) bex = ex; error = new MyGenError(); error.errorClass = MyGenErrorClass.Application; PopulateErrorFromException(error, bex); myGenErrors.Add(error); } } return myGenErrors; }
public static void PopulateErrorFromException(MyGenError error, Exception ex) { StringBuilder sb = new StringBuilder(); error.errorType = ex.GetType().Name; error.message = ex.Message; error.detail = ex.StackTrace; error.SourceFile = ex.Source; StackTrace st = new StackTrace(ex); StackFrame[] sfs = st.GetFrames(); foreach (StackFrame sf in sfs) { error.lineNumber = sf.GetFileLineNumber(); error.ColumnNumber = sf.GetFileColumnNumber(); error.SourceFile = sf.GetFileName(); error.SourceLine = sf.GetMethod().Name; break; } }
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 static List <IMyGenError> CreateErrors(params Exception[] exceptions) { MyGenError error; List <IMyGenError> myGenErrors = new List <IMyGenError>(); foreach (Exception loopex in exceptions) { Exception ex = loopex, bex = ex.GetBaseException(); if (ex is ZeusRuntimeException) { ZeusRuntimeException zrex = ex as ZeusRuntimeException; if (bex is ZeusExecutionException) { ZeusExecutionException zeex = bex as ZeusExecutionException; foreach (IZeusExecutionError zee in zeex.Errors) { error = new MyGenError(); error.errorClass = MyGenErrorClass.Template; error.templateFileName = zrex.Template.FilePath + zrex.Template.FileName; error.TemplateIdentifier = zrex.Template.UniqueID; error.IsTemplateCodeSegment = zrex.IsTemplateScript; PopulateErrorFromZeusExecError(error, zee); myGenErrors.Add(error); } } else { error = new MyGenError(); error.errorClass = MyGenErrorClass.Template; error.templateFileName = zrex.Template.FilePath + zrex.Template.FileName; error.TemplateIdentifier = zrex.Template.UniqueID; error.IsTemplateCodeSegment = zrex.IsTemplateScript; error.isRuntime = true; PopulateErrorFromException(error, bex); myGenErrors.Add(error); } } else if (ex is ZeusExecutionException) { ZeusExecutionException zeex = ex as ZeusExecutionException; foreach (IZeusExecutionError zee in zeex.Errors) { error = new MyGenError(); error.errorClass = MyGenErrorClass.Template; error.templateFileName = zeex.Template.FilePath + zeex.Template.FileName; error.TemplateIdentifier = zeex.Template.UniqueID; error.IsTemplateCodeSegment = zeex.IsTemplateScript; PopulateErrorFromZeusExecError(error, zee); myGenErrors.Add(error); } } else { if (bex == null) { bex = ex; } error = new MyGenError(); error.errorClass = MyGenErrorClass.Application; PopulateErrorFromException(error, bex); myGenErrors.Add(error); } } return(myGenErrors); }