Exemplo n.º 1
0
        //------------------------------------------------------------
        // BCErrorInfoManager.GetErrorKind
        //
        /// <summary>
        /// Get an ERROORKIND value from a CSCERRID value.
        /// </summary>
        /// <param name="errID"></param>
        /// <returns></returns>
        //------------------------------------------------------------
        internal ERRORKIND GetErrorKind(ERRID errID)
        {
            int level;

            if (GetWarningLevel(errID, out level))
            {
                return(ErrorUtil.GetErrorKind(level));
            }
            return(ERRORKIND.NONE);
        }
Exemplo n.º 2
0
        //------------------------------------------------------------
        // BCErrorInfoManager.FormatErrorMessage (2)
        //
        /// <summary>
        /// <para>Get the format string by id,
        /// create an error message with args and locations</para>
        /// </summary>
        /// <param name="excp"></param>
        /// <param name="errID"></param>
        /// <param name="errKind"></param>
        /// <param name="fileName"></param>
        /// <param name="lineStart"></param>
        /// <param name="colStart"></param>
        /// <param name="lineEnd"></param>
        /// <param name="colEnd"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        //------------------------------------------------------------
        internal string FormatErrorMessage(
            out Exception excp,
            ERRID errID,
            ERRORKIND errKind,
            string fileName,
            int lineStart,
            int colStart,
            int lineEnd,
            int colEnd,
            params Object[] args)
        {
            int   errorNo = -1;
            ResNo resNo   = ResNo.Invalid;

            ERRORINFO eInfo = GetInfo(errID);

            if (eInfo != null)
            {
                errorNo = eInfo.ErrorNumber;
                resNo   = eInfo.ResourceNumber;
                if (!ErrorUtil.IsValidErrorKind(errKind))
                {
                    errKind = ErrorUtil.GetErrorKind(eInfo.WarningLevel);
                }
            }
            else
            {
                resNo = ResNo.CSCSTR_InternalError;
                args  = new Object[] { "invalid error ID in CSResources.FormatErrorMessage" };
            }

            return(ErrorUtil.FormatErrorMessage(
                       out excp,
                       errKind,
                       this.Prefix,
                       errorNo,
                       resNo,
                       fileName,
                       lineStart,
                       colStart,
                       lineEnd,
                       colEnd,
                       args));
        }