コード例 #1
0
        /// <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);
        }
コード例 #2
0
ファイル: LError.cs プロジェクト: GHLabs/SambaPOS-3
 /// <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;
 }