/// <summary> /// Converts from a LangException to LError datatype /// </summary> /// <param name="exc">The exception to convert to an LError</param> /// <returns></returns> public static LError FromException(Exception exc) { LError error = null; if (exc is LangException) { var ex = exc as LangException; // Create new instance of language error. error = new LError() { LineNumber = ex.Error.Line, name = ex.Error.Message, message = ex.Message, Source = ex.Error.File, StackTrace = ex.StackTrace }; return(error); } // Create new instance of language error. error = new LError(); error.name = string.Empty; error.message = exc.Message; error.StackTrace = exc.StackTrace; return(error); }
/// <summary> /// Converts from a LangException to LError datatype /// </summary> /// <param name="exc">The exception to convert to an LError</param> /// <returns></returns> public static LError FromException(Exception exc) { LError error = null; if (exc is LangException) { var ex = exc as LangException; // Create new instance of language error. error = new LError() { LineNumber = ex.Error.Line, name = ex.Error.Message, message = ex.Message, Source = ex.Error.File, StackTrace = ex.StackTrace }; return error; } // Create new instance of language error. error = new LError(); error.name = string.Empty; error.message = exc.Message; error.StackTrace = exc.StackTrace; return error; }