示例#1
0
 private static string BuildErrorMessage(string jobDescription, CimJobContext jobContext, string errorMessage)
 {
     if (!string.IsNullOrEmpty(jobDescription))
     {
         object[] objArray = new object[2];
         objArray[0] = errorMessage;
         objArray[1] = jobDescription;
         string str = string.Format(CultureInfo.InvariantCulture, CmdletizationResources.CimJob_GenericCimFailure, objArray);
         return(jobContext.PrependComputerNameToMessage(str));
     }
     else
     {
         return(jobContext.PrependComputerNameToMessage(errorMessage));
     }
 }
示例#2
0
        internal static CimJobException CreateWithFullControl(CimJobContext jobContext, string message, string errorId, ErrorCategory errorCategory, Exception inner = null)
        {
            CimJobException cimJobException = new CimJobException(jobContext.PrependComputerNameToMessage(message), inner);

            cimJobException.InitializeErrorRecord(jobContext, errorId, errorCategory);
            return(cimJobException);
        }
示例#3
0
        private static string BuildErrorMessage(string jobDescription, CimJobContext jobContext, string errorMessage)
        {
            Dbg.Assert(!string.IsNullOrEmpty(errorMessage), "Caller should verify !string.IsNullOrEmpty(errorMessage)");

            if (string.IsNullOrEmpty(jobDescription))
            {
                return(jobContext.PrependComputerNameToMessage(errorMessage));
            }
            else
            {
                string errorMessageWithJobDescription = string.Format(
                    CultureInfo.InvariantCulture,
                    CmdletizationResources.CimJob_GenericCimFailure,
                    errorMessage,
                    jobDescription);
                return(jobContext.PrependComputerNameToMessage(errorMessageWithJobDescription));
            }
        }
示例#4
0
        internal static CimJobException CreateWithFullControl(
            CimJobContext jobContext,
            string message,
            string errorId,
            ErrorCategory errorCategory,
            Exception inner = null)
        {
            Dbg.Assert(jobContext != null, "Caller should verify jobContext != null");
            Dbg.Assert(!string.IsNullOrEmpty(message), "Caller should verify message != null");
            Dbg.Assert(!string.IsNullOrEmpty(errorId), "Caller should verify errorId != null");

            CimJobException cimJobException = new CimJobException(jobContext.PrependComputerNameToMessage(message), inner);

            cimJobException.InitializeErrorRecord(jobContext, errorId, errorCategory);
            return(cimJobException);
        }
示例#5
0
		private static string BuildErrorMessage(string jobDescription, CimJobContext jobContext, string errorMessage)
		{
			if (!string.IsNullOrEmpty(jobDescription))
			{
				object[] objArray = new object[2];
				objArray[0] = errorMessage;
				objArray[1] = jobDescription;
				string str = string.Format(CultureInfo.InvariantCulture, CmdletizationResources.CimJob_GenericCimFailure, objArray);
				return jobContext.PrependComputerNameToMessage(str);
			}
			else
			{
				return jobContext.PrependComputerNameToMessage(errorMessage);
			}
		}
示例#6
0
		internal static CimJobException CreateWithFullControl(CimJobContext jobContext, string message, string errorId, ErrorCategory errorCategory, Exception inner = null)
		{
			CimJobException cimJobException = new CimJobException(jobContext.PrependComputerNameToMessage(message), inner);
			cimJobException.InitializeErrorRecord(jobContext, errorId, errorCategory);
			return cimJobException;
		}
示例#7
0
        private static string BuildErrorMessage(string jobDescription, CimJobContext jobContext, string errorMessage)
        {
            Dbg.Assert(!string.IsNullOrEmpty(errorMessage), "Caller should verify !string.IsNullOrEmpty(errorMessage)");

            if (string.IsNullOrEmpty(jobDescription))
            {
                return jobContext.PrependComputerNameToMessage(errorMessage);
            }
            else
            {
                string errorMessageWithJobDescription = string.Format(
                    CultureInfo.InvariantCulture,
                    CmdletizationResources.CimJob_GenericCimFailure,
                    errorMessage,
                    jobDescription);
                return jobContext.PrependComputerNameToMessage(errorMessageWithJobDescription);
            }
        }
示例#8
0
        internal static CimJobException CreateWithFullControl(
            CimJobContext jobContext,
            string message,
            string errorId,
            ErrorCategory errorCategory,
            Exception inner = null)
        {
            Dbg.Assert(jobContext != null, "Caller should verify jobContext != null");
            Dbg.Assert(!string.IsNullOrEmpty(message), "Caller should verify message != null");
            Dbg.Assert(!string.IsNullOrEmpty(errorId), "Caller should verify errorId != null");

            CimJobException cimJobException = new CimJobException(jobContext.PrependComputerNameToMessage(message), inner);
            cimJobException.InitializeErrorRecord(jobContext, errorId, errorCategory);
            return cimJobException;
        }