예제 #1
0
        /// <summary>
        /// Conversion between an error internal representation and ErrorRecord
        /// </summary>
        /// <param name="error">internal error object</param>
        /// <returns>corresponding ErrorRecord instance</returns>
        private static ErrorRecord GenerateErrorRecord(FormattingError error)
        {
            ErrorRecord        errorRecord        = null;
            string             msg                = null;
            MshExpressionError mshExpressionError = error as MshExpressionError;

            if (mshExpressionError != null)
            {
                errorRecord = new ErrorRecord(
                    mshExpressionError.result.Exception,
                    "mshExpressionError",
                    ErrorCategory.InvalidArgument,
                    mshExpressionError.sourceObject);

                msg = StringUtil.Format(FormatAndOut_format_xxx.MshExpressionError,
                                        mshExpressionError.result.ResolvedExpression.ToString());
                errorRecord.ErrorDetails = new ErrorDetails(msg);
            }

            StringFormatError formattingError = error as StringFormatError;

            if (formattingError != null)
            {
                errorRecord = new ErrorRecord(
                    formattingError.exception,
                    "formattingError",
                    ErrorCategory.InvalidArgument,
                    formattingError.sourceObject);

                msg = StringUtil.Format(FormatAndOut_format_xxx.FormattingError,
                                        formattingError.formatString);
                errorRecord.ErrorDetails = new ErrorDetails(msg);
            }
            return(errorRecord);
        }
예제 #2
0
 private static ErrorRecord GenerateErrorRecord(FormattingError error)
 {
     ErrorRecord record = null;
     string message = null;
     MshExpressionError error2 = error as MshExpressionError;
     if (error2 != null)
     {
         record = new ErrorRecord(error2.result.Exception, "mshExpressionError", ErrorCategory.InvalidArgument, error2.sourceObject);
         message = StringUtil.Format(FormatAndOut_format_xxx.MshExpressionError, error2.result.ResolvedExpression.ToString());
         record.ErrorDetails = new ErrorDetails(message);
     }
     StringFormatError error3 = error as StringFormatError;
     if (error3 != null)
     {
         record = new ErrorRecord(error3.exception, "formattingError", ErrorCategory.InvalidArgument, error3.sourceObject);
         message = StringUtil.Format(FormatAndOut_format_xxx.FormattingError, error3.formatString);
         record.ErrorDetails = new ErrorDetails(message);
     }
     return record;
 }
예제 #3
0
        private static ErrorRecord GenerateErrorRecord(FormattingError error)
        {
            ErrorRecord        record  = null;
            string             message = null;
            MshExpressionError error2  = error as MshExpressionError;

            if (error2 != null)
            {
                record              = new ErrorRecord(error2.result.Exception, "mshExpressionError", ErrorCategory.InvalidArgument, error2.sourceObject);
                message             = StringUtil.Format(FormatAndOut_format_xxx.MshExpressionError, error2.result.ResolvedExpression.ToString());
                record.ErrorDetails = new ErrorDetails(message);
            }
            StringFormatError error3 = error as StringFormatError;

            if (error3 != null)
            {
                record              = new ErrorRecord(error3.exception, "formattingError", ErrorCategory.InvalidArgument, error3.sourceObject);
                message             = StringUtil.Format(FormatAndOut_format_xxx.FormattingError, error3.formatString);
                record.ErrorDetails = new ErrorDetails(message);
            }
            return(record);
        }
예제 #4
0
        /// <summary>
        /// Conversion between an error internal representation and ErrorRecord
        /// </summary>
        /// <param name="error">internal error object</param>
        /// <returns>corresponding ErrorRecord instance</returns>
        private static ErrorRecord GenerateErrorRecord(FormattingError error)
        {
            ErrorRecord errorRecord = null;
            string msg = null;
            MshExpressionError mshExpressionError = error as MshExpressionError;
            if (mshExpressionError != null)
            {
                errorRecord = new ErrorRecord(
                                mshExpressionError.result.Exception,
                                "mshExpressionError",
                                ErrorCategory.InvalidArgument,
                                mshExpressionError.sourceObject);

                msg = StringUtil.Format(FormatAndOut_format_xxx.MshExpressionError,
                    mshExpressionError.result.ResolvedExpression.ToString());
                errorRecord.ErrorDetails = new ErrorDetails(msg);
            }

            StringFormatError formattingError = error as StringFormatError;
            if (formattingError != null)
            {
                errorRecord = new ErrorRecord(
                                formattingError.exception,
                                "formattingError",
                                ErrorCategory.InvalidArgument,
                                formattingError.sourceObject);

                msg = StringUtil.Format(FormatAndOut_format_xxx.FormattingError,
                    formattingError.formatString);
                errorRecord.ErrorDetails = new ErrorDetails(msg);
            }
            return errorRecord;
        }