internal RuntimeException(string message, string errorId, ErrorCategory category, object target) : base(message, null) { Id = errorId; Category = category; TargetObject = target; }
internal PSInvalidOperationException(string message, string id, ErrorCategory errorCategory, Exception innerException, bool terminating = true) : base(message, innerException) { Terminating = terminating; ErrorRecord = new ErrorRecord(this, id, errorCategory, null); }
/// <summary> /// /// </summary> /// <param name="fullyQualifiedErrorId"></param> /// <param name="errorCategory"></param> /// <param name="innerException"></param> /// <param name="resourceId"></param> /// <param name="resourceParms"></param> /// <returns></returns> internal static ErrorRecord CreateErrorRecord( string fullyQualifiedErrorId, ErrorCategory errorCategory, Exception innerException, string resourceId, params object[] resourceParms) { InvalidOperationException invalidOperationException; string errorMessage = string.Format( CultureInfo.CurrentCulture, resourceId, resourceParms); if (innerException != null) { invalidOperationException = new InvalidOperationException(errorMessage, innerException); } else { invalidOperationException = new InvalidOperationException(errorMessage); } ErrorRecord errorRecord = new ErrorRecord( invalidOperationException, fullyQualifiedErrorId, errorCategory, null); return errorRecord; }
public static void SetUpException(ref Exception exception, string errorCode, ErrorCategory errorCategory, object target) { exception.Data[ERROR_CODE] = errorCode; exception.Data[ERROR_CATEGORY] = errorCategory; exception.Data[ERROR_TARGET] = target; }
public ErrorRecord(Exception exception, string errorId, ErrorCategory errorCategory, object targetObject) { Exception = exception; ErrorId = errorId; TargetObject = targetObject; CategoryInfo = new ErrorCategoryInfo(exception, errorCategory); }
protected SessionStateException(SerializationInfo info, StreamingContext context) : base(info, context) { this._itemName = string.Empty; this._errorId = "SessionStateException"; this._errorCategory = ErrorCategory.InvalidArgument; this._sessionStateCategory = (System.Management.Automation.SessionStateCategory) info.GetInt32("SessionStateCategory"); }
//public EventHandler<NavigationRequestedEventArgs> NavigationRequested { get; set; } private void DisplayErrors(ErrorCategory category) { lvErrors.Items.Clear(); if (errors == null) return; int errorCount = 0, warningCount = 0, messageCount = 0; foreach (Error error in errors) { if ((error.Category & category) != 0) { ListViewItem item = new ListViewItem(); item.Text = error.Location.ToString(); item.SubItems.Add(error.Message); item.Tag = error; lvErrors.Items.Add(item); } switch (error.Category) { case ErrorCategory.Error: errorCount++; break; case ErrorCategory.Warning: warningCount++; break; case ErrorCategory.Message: messageCount++; break; } } btnErrors.Text = errorCount + " Errors"; btnWarnings.Text = warningCount + " Warnings"; btnMessages.Text = messageCount + " Messages"; btnErrors.Enabled = (errorCount > 0); btnWarnings.Enabled = (warningCount > 0); btnMessages.Enabled = (messageCount > 0); }
/// <summary> /// Class constructor /// </summary> /// <param name="errorId">FullyQualifiedErrorId</param> /// <param name="message">exception message</param> /// <param name="cat">category</param> /// <param name="targetObject">target object</param> /// <param name="innerException">inner exception</param> internal UpdatableHelpSystemException(string errorId, string message, ErrorCategory cat, object targetObject, Exception innerException) : base(message, innerException) { FullyQualifiedErrorId = errorId; ErrorCategory = cat; TargetObject = targetObject; }
public ErrorRecord(ErrorRecord errorRecord, System.Exception replaceParentContainsErrorRecordException) { this.pipelineIterationInfo = new ReadOnlyCollection<int>(new int[0]); if (errorRecord == null) { throw new PSArgumentNullException("errorRecord"); } if ((replaceParentContainsErrorRecordException != null) && (errorRecord.Exception is ParentContainsErrorRecordException)) { this._error = replaceParentContainsErrorRecordException; } else { this._error = errorRecord.Exception; } this._target = errorRecord.TargetObject; this._errorId = errorRecord._errorId; this._category = errorRecord._category; this._activityOverride = errorRecord._activityOverride; this._reasonOverride = errorRecord._reasonOverride; this._targetNameOverride = errorRecord._targetNameOverride; this._targetTypeOverride = errorRecord._targetTypeOverride; if (errorRecord.ErrorDetails != null) { this._errorDetails = new System.Management.Automation.ErrorDetails(errorRecord.ErrorDetails); } this.SetInvocationInfo(errorRecord._invocationInfo); this._scriptStackTrace = errorRecord._scriptStackTrace; this._serializedFullyQualifiedErrorId = errorRecord._serializedFullyQualifiedErrorId; }
internal ParameterBindingValidationException(Exception innerException, ErrorCategory errorCategory, InvocationInfo invocationInfo, IScriptExtent errorPosition, string parameterName, Type parameterType, Type typeSpecified, string resourceBaseName, string errorIdAndResourceId, params object[] args) : base(innerException, errorCategory, invocationInfo, errorPosition, parameterName, parameterType, typeSpecified, resourceBaseName, errorIdAndResourceId, args) { ValidationMetadataException exception = innerException as ValidationMetadataException; if ((exception != null) && exception.SwallowException) { this._swallowException = true; } }
internal PSInvalidOperationException(string message, Exception innerException, string errorId, ErrorCategory errorCategory, object target) : base(message, innerException) { this._errorId = "InvalidOperation"; this._errorCategory = ErrorCategory.InvalidOperation; this._errorId = errorId; this._errorCategory = errorCategory; this._target = target; }
public ReportableException(string message, Exception innerException, ErrorCategory category, string errorId, object targetObject) : base(message, innerException) { _category = category; _errorId = errorId; _targetObject = targetObject; }
/// <summary> /// Initializes a new instance of the <see cref="OrchardProviderException"/> class. /// </summary> /// <param name="message">The exception's message.</param> /// <param name="fatal">if set to <c>true</c> indicates that the error is fatal.</param> /// <param name="errorId">The error identifier.</param> /// <param name="category">The error category.</param> public OrchardProviderException( string message, bool fatal, string errorId, ErrorCategory category = ErrorCategory.NotSpecified) : base(message, fatal, errorId, category) { }
internal CommandNotFoundException(string commandName, Exception innerException, string errorIdAndResourceId, string resourceStr, params object[] messageArgs) : base(BuildMessage(commandName, errorIdAndResourceId, resourceStr, messageArgs), innerException) { this.commandName = string.Empty; this._errorId = "CommandNotFoundException"; this._errorCategory = ErrorCategory.ObjectNotFound; this.commandName = commandName; this._errorId = errorIdAndResourceId; }
/// <summary> /// Throws a terminating error. /// </summary> /// <param name="targetObject">Object which caused this exception.</param> /// <param name="errorId">ErrorId for this error.</param> /// <param name="innerException">Complete exception object.</param> /// <param name="category">ErrorCategory for this exception.</param> internal void ThrowError( Object targetObject, string errorId, Exception innerException, ErrorCategory category) { ThrowTerminatingError(new ErrorRecord(innerException, errorId, category, targetObject)); }
internal ErrorCategoryInfo(Exception exception, ErrorCategory category) { this.Category = category; this.Activity = string.Empty; this.Reason = exception.GetType().Name; this.TargetName = string.Empty; this.TargetType = string.Empty; }
/// <summary> /// See <see cref="ILogHelper.DefineFatalLogMessage"/> for more details. /// </summary> /// <param name="message"> /// The message to be logged. /// </param> /// <param name="errorCategory"> /// The specifics of the error origin. /// </param> /// <param name="errorType"> /// The type of error being logged. /// </param> /// <param name="exception"> /// The exception (if one exists) associated with the error. /// </param> /// <returns> /// A new, initalised <see cref="LogMessage"/> instance. /// </returns> public LogMessage DefineFatalLogMessage(string message, ErrorCategory errorCategory, ErrorType errorType, BaseException exception = null) { var logMessage = new LogMessage(TraceEventType.Critical); logMessage.Exception = exception; logMessage.Message = message; logMessage.ErrorCode = new ErrorCode(Severity.Critical, errorCategory, errorType); return logMessage; }
internal SessionStateException(string itemName, System.Management.Automation.SessionStateCategory sessionStateCategory, string errorIdAndResourceId, string resourceStr, ErrorCategory errorCategory, params object[] messageArgs) : base(BuildMessage(itemName, errorIdAndResourceId, resourceStr, messageArgs)) { this._itemName = string.Empty; this._errorId = "SessionStateException"; this._errorCategory = ErrorCategory.InvalidArgument; this._itemName = itemName; this._sessionStateCategory = sessionStateCategory; this._errorId = errorIdAndResourceId; this._errorCategory = errorCategory; }
public void CreateFromException_WithExceptionAndErrorCategory_ReturnsErrorRecordWithSameErrorCategory( ErrorCategory errorCategory, Exception exception) { // When var result = ErrorRecordFactory.CreateFromException(exception, errorCategory); // Then Assert.Equal(errorCategory, result.CategoryInfo.Category); }
public static void GenerateSecurityExceptionResponse(this HttpActionContext actionContext, Type responsePayloadType, string exceptionCode, string exceptionDescription, ErrorCategory category = ErrorCategory.Security, ErrorSeverity severity = ErrorSeverity.Error) { GenerateExceptionResponse(actionContext, responsePayloadType, new ResponseMessage { Code = exceptionCode, Description = exceptionDescription, Category = category, Severity = severity }); }
/// <summary> /// Creates an instance of ErrorForm and show /// </summary> /// <param name="exception">exception as any</param> /// <param name="category">error category</param> /// <param name="currentLanguageID">current user language</param> public static void ShowError(Exception exception, ErrorCategory category, int currentLanguageID) { ErrorForm form = new ErrorForm(exception, category, currentLanguageID); if (null != MainForm.Singleton && MainForm.Singleton.Visible) form.ShowDialog(MainForm.Singleton); else { form.StartPosition = FormStartPosition.CenterScreen; form.ShowDialog(); } }
internal SessionStateException(string itemName, SessionStateCategory sessionStateCategory, string errorIdAndResourceId, ErrorCategory errorCategory, params object[] messageArgs) : base(String.Format("The {0} \"{1}\" ({2}) caused the following error: {3}", new object[] {sessionStateCategory.ToString(), itemName, errorIdAndResourceId, errorCategory.ToString()})) { //TODO: make this better SessionStateCategory = sessionStateCategory; ErrorRecord = new ErrorRecord(this, errorIdAndResourceId, errorCategory, null); }
protected CommandNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { this.commandName = string.Empty; this._errorId = "CommandNotFoundException"; this._errorCategory = ErrorCategory.ObjectNotFound; if (info == null) { throw new PSArgumentNullException("info"); } this.commandName = info.GetString("CommandName"); }
public ErrorForm(Exception exception, ErrorCategory category, int currentLanguageID) { InitializeComponent(); _category = category; if (ErrorCategory.Critical == category) labelExitMessage.Visible = true; DisplayException(exception); currentLanguageID = ValidateLanguageID(currentLanguageID); Translator.TranslateControls(this, "ErrorFormMessageTable.txt", currentLanguageID); this.Height = buttonOK.Top + buttonOK.Height + 40; }
/// <summary> /// Creates an <see cref="ErrorRecord"/> object using the specified arguments. /// </summary> /// <param name="exception">The <see cref="Exception"/> that is the source of error.</param> /// <param name="errorCategory">The optional error category. The default value is <see cref="F:ErrorCategory.NotSpecified"/></param> /// <param name="targetObject">The optional target object. The default value is <see langword="null"/>.</param> /// <returns>An <see cref="ErrorRecord"/> object.</returns> public static ErrorRecord CreateFromException( Exception exception, ErrorCategory errorCategory = ErrorCategory.NotSpecified, object targetObject = null) { if (exception == null) { throw new ArgumentNullException("exception"); } return new ErrorRecord(exception, exception.GetType().FullName, errorCategory, targetObject); }
/// <summary> /// Adds a message of the given document to the error list. /// </summary> public void AddMessage(string message, string document, ErrorCategory errorCategory) { var errorTask = new ErrorTask { ErrorCategory = (TaskErrorCategory)errorCategory, Text = message, Document = document, }; this.ErrorListProvider.Tasks.Add(errorTask); this.ErrorListProvider.Show(); this.ErrorListProvider.BringToFront(); }
public MethodInvocationException(string message, Exception innerException, string errorId, ErrorCategory errorCategory) : base(message, innerException) { var runtimeException = innerException as IContainsErrorRecord; if (errorId == null) { errorId = runtimeException == null ? "MethodInvocation" : runtimeException.ErrorRecord.ErrorId; } if (errorCategory == ErrorCategory.NotSpecified && runtimeException != null) { errorCategory = runtimeException.ErrorRecord.CategoryInfo.Category; } ErrorRecord = new ErrorRecord(this, errorId, errorCategory, null); }
internal RuntimeException(ErrorCategory errorCategory, InvocationInfo invocationInfo, IScriptExtent errorPosition, string errorIdAndResourceId, string message, Exception innerException) : base(message, innerException) { this._errorId = "RuntimeException"; this.SetErrorCategory(errorCategory); this.SetErrorId(errorIdAndResourceId); if ((errorPosition == null) && (invocationInfo != null)) { errorPosition = invocationInfo.ScriptPosition; } if (invocationInfo != null) { this._errorRecord = new System.Management.Automation.ErrorRecord(new ParentContainsErrorRecordException(this), this._errorId, this._errorCategory, this._targetObject); this._errorRecord.SetInvocationInfo(new InvocationInfo(invocationInfo.MyCommand, errorPosition)); } }
/// <summary> /// Writes a terminating error message to the PS provider. /// </summary> /// <param name="cmdlet">The cmdlet instance.</param> /// <param name="exception">The exception which contains the details of the error.</param> /// <param name="errorId">The error identifier (for PowerShell).</param> /// <param name="category">The error category (for PowerShell).</param> /// <param name="target">The target object of the current operation (for PowerShell), optional.</param> public static void ThrowTerminatingError( this IOrchardCmdlet cmdlet, Exception exception, string errorId, ErrorCategory category, object target = null) { if (cmdlet == null) { throw new ArgumentNullException("cmdlet"); } var errorRecord = new ErrorRecord(exception, errorId, category, target); cmdlet.ThrowTerminatingError(errorRecord); }
/// <summary> /// Writes a non-terminating error. /// </summary> /// <param name="service"></param> /// <param name="innerException"></param> /// <param name="errorId"></param> /// <param name="errorMessage"></param> /// <param name="category"></param> internal void WriteNonTerminatingError( ServiceController service, Exception innerException, string errorId, string errorMessage, ErrorCategory category) { WriteNonTerminatingError( service.ServiceName, service.DisplayName, service, innerException, errorId, errorMessage, category); }
// Token: 0x0600087B RID: 2171 RVA: 0x00028AB4 File Offset: 0x00026CB4 internal void WriteError(Exception error, ErrorCategory errorCategory, object target) { this.WriteErrorEx(error, errorCategory, target); }
public static ErrorRecord GetGeneric(string messageOrTemplate, string errorId, ErrorCategory errorCategory, params object[] objects) { Contract.Requires(!string.IsNullOrWhiteSpace(messageOrTemplate)); Contract.Requires(!string.IsNullOrWhiteSpace(errorId)); Contract.Requires(Enum.IsDefined(typeof(ErrorCategory), errorCategory)); Contract.Ensures(null != Contract.Result <ErrorRecord>()); var message = new StringBuilder(); if (null != objects) { message.AppendFormat(messageOrTemplate, objects); } else { message.Append(message); } var exception = new Exception(message.ToString()); var errorRecord = new ErrorRecord(exception, errorId, errorCategory, objects?[0]); return(errorRecord); }
internal static void ReportError(this IProviderContext context, string errorId, string errorMessage, ErrorCategory errorCategory, object targetobject) { context.WriteError(new ErrorRecord(new Exception(errorMessage), errorId, errorCategory, targetobject)); }
private void WriteNonTerminatingError(Exception exception, string resourceId, string errorId, ErrorCategory category, string _logName, string _compName, string _source, string _resourceFile) { object[] objArray = new object[4]; objArray[0] = _logName; objArray[1] = _compName; objArray[2] = _source; objArray[3] = _resourceFile; Exception exception1 = new Exception(StringUtil.Format(resourceId, objArray), exception); base.WriteError(new ErrorRecord(exception1, errorId, category, null)); }
internal TaskFailureInformation(ErrorCategory category) { Category = category; }
public AlmException(string message, ErrorCategory categ = ErrorCategory.NotSpecified) : base(message) { _category = categ; }
/// <summary> /// Initializes a new instance of the <see cref="ServerRegistrationException" /> class. /// </summary> /// <param name="internalErrorCode">The internal error code.</param> /// <param name="errorCode">The error code.</param> /// <param name="category">The category.</param> public ServerRegistrationException(ServerRegistrationErrorCode internalErrorCode, int errorCode, ErrorCategory category) { InternalErrorCode = internalErrorCode; ExternalErrorCode = errorCode; Category = category; }
public LogicalException(ErrorCategory category) { Category = category; }
private void InitializeErrorRecordCore(CimJobContext jobContext, Exception exception, string errorId, ErrorCategory errorCategory) { ErrorRecord coreErrorRecord = new ErrorRecord( exception: exception, errorId: errorId, errorCategory: errorCategory, targetObject: jobContext != null ? jobContext.TargetObject : null); if (jobContext != null) { System.Management.Automation.Remoting.OriginInfo originInfo = new System.Management.Automation.Remoting.OriginInfo( jobContext.Session.ComputerName, Guid.Empty); _errorRecord = new System.Management.Automation.Runspaces.RemotingErrorRecord( coreErrorRecord, originInfo); _errorRecord.SetInvocationInfo(jobContext.CmdletInvocationInfo); _errorRecord.PreserveInvocationInfoOnce = true; } else { _errorRecord = coreErrorRecord; } }
public LogicalException(ErrorCategory category, string message, Exception inner) : base(message, inner) { Category = category; }
public bool Error(ErrorCategory category, string targetObjectValue, string messageText, params object[] args) { return(Error(messageText, category.ToString(), targetObjectValue, FormatMessageString(messageText, args))); }
internal LocalAccountsException(string message, object target, ErrorCategory errorCategory) : base(message) { ErrorCategory = errorCategory; Target = target; }
public void LogError(ErrorCategory errorCategory, string message) { throw new System.NotImplementedException(); }
private void WriteErrorAndAddMonitoringEvent(Exception exception, ErrorCategory errorCategory, SmtpConnectivityStatusCode statusCode) { this.monitoringData.Events.Add(new MonitoringEvent("MSExchange Monitoring SmtpConnectivity", (int)statusCode, EventTypeEnumeration.Error, exception.Message)); base.WriteError(exception, errorCategory, null); }
/// <summary> /// This method adds a validation error message. /// </summary> /// <param name="propertyName">Contains the property name error occurred.</param> /// <param name="message">Contains the error message text.</param> /// <param name="category">Contains the error message category.</param> /// <returns>Returns a new error message.</returns> public IErrorMessage CreateValidationMessage(string propertyName, string message, ErrorCategory category = ErrorCategory.General) { return(new ErrorMessage(propertyName, message, category)); }
internal void WriteNonTerminatingError(object targetObject, string errorId, Exception innerException, ErrorCategory category) { base.WriteError(new ErrorRecord(innerException, errorId, category, targetObject)); }
public static void SaveLogFile(string copyToFile, bool overwrite) { lock ( sm_syncRoot ) { Trace("(saving log to \"{0}\")", copyToFile); if (null == sm_logFile) { throw new DbgProviderException(Resources.ErrMsgTracingFailed, "FailedToSaveTraceTracingDisabled", ErrorCategory.OpenError); } Exception e = null; // If we stop the trace session, the tracing won't be cumulative (because // ETW does not support "appending" to a circular file, so when you // restart tracing, the old contents get wiped out). We don't want that, // so we're just going to copy the "live" trace file. // // Improvements in the ProcessTrace function in Win8 have made it tolerant // of un-finalized circular files (alexbe). But if we want to inspect such // trace files on down-level machines, we'll need to finalize them // ourselves. // // I'll preserve the old behavior, switched by a reg value, "just in // case". if (0 == RegistryUtils.GetRegValue("RestartTracing", 0)) { Trace("(not stopping tracing)"); Flush(); string errorId = "FailedToSaveTrace"; e = Util.TryWin32IO(() => { File.Copy(sm_logFile, copyToFile, overwrite); errorId = "FailedToFinalizeTrace"; _FinalizeTraceFile(copyToFile); }); if (null != e) { ErrorCategory ec = Util.GetErrorCategoryForException(e); throw new DbgProviderException(Util.McSprintf(Resources.ErrMsgCouldNotSaveTraceFmt, copyToFile, Util.GetExceptionMessages(e)), errorId, ec, e); } } else { Trace("========================= Stopping trace at {0} =========================", DateTime.Now); Util.TryWin32IO(() => { int err = NativeMethods.ControlTrace(sm_traceHandle, null, sm_etp, EventTraceControl.Stop); if ((0 == err) || (ERROR_MORE_DATA == err)) { File.Copy(sm_logFile, copyToFile, overwrite); _StartTracing(sm_eventSource.Value); } else { // N.B. Not using Util.Fail here, since Util.Fail traces. Debug.Fail(Util.Sprintf("This call should not fail: {0}.", err)); } }); if (null != e) { ErrorCategory ec = Util.GetErrorCategoryForException(e); throw new DbgProviderException(Util.McSprintf(Resources.ErrMsgCouldNotSaveTraceFmt, copyToFile, Util.GetExceptionMessages(e)), "FailedToSaveTrace", ec, e); } } // end else( we want to stop and restart the trace ) } // end lock( sm_syncRoot ) } // end SaveLogFile()
PromptingException(string message, Exception innerException, string errorId, ErrorCategory errorCategory) : base(message, innerException, errorId, errorCategory) { }
public Fault(string e, string m, ErrorCategory c = ErrorCategory.General) : this("InnovationPortalService", e, m, c) { }
internal static void ProcessRpcError(RpcException e, string server, out LocalizedException outException, out ErrorCategory outCategory) { if (e.ErrorCode == 1753) { outException = new LocalizedException(Strings.RpcNotRegistered(server)); outCategory = ErrorCategory.ResourceUnavailable; return; } if (e.ErrorCode == 1722) { outException = new LocalizedException(Strings.RpcUnavailable(server)); outCategory = ErrorCategory.InvalidOperation; return; } Win32Exception ex = new Win32Exception(e.ErrorCode); outException = new LocalizedException(Strings.GenericRpcError(server, ex.Message), ex); outCategory = ErrorCategory.InvalidOperation; }
/// <summary> /// Initializes a new instance of the AzureStorageFileException class. /// </summary> /// <param name="category">Indicating the error cateogory.</param> /// <param name="errorId">Indicating the error id.</param> /// <param name="errorDetails">Indicating the error message.</param> /// <param name="targetObject">Indicating the target object.</param> public AzureStorageFileException(ErrorCategory category, string errorId, string errorDetails, object targetObject) : base(errorDetails) { this.record = new ErrorRecord(this, errorId, category, targetObject); this.record.ErrorDetails = new ErrorDetails(errorDetails); }
/// <summary> /// This method is used to create a new empty <see cref="IErrorMessage" /> object. /// </summary> /// <param name="message">Contains the error message text.</param> /// <param name="type">Contains the error message type.</param> /// <param name="stackTrace">Contains the stack trace text.</param> /// <param name="category">Contains the error message category.</param> /// <returns>Returns a new instance of the <see cref="IErrorMessage" /> object.</returns> public IErrorMessage CreateErrorMessage(string message, ErrorType type, string stackTrace, ErrorCategory category = ErrorCategory.General) { return(new ErrorMessage(message, type, stackTrace, category)); }
internal static byte[] SerializeError(ExchangeCertificateRpcVersion version, string message, ErrorCategory category) { if (version == ExchangeCertificateRpcVersion.Version2) { return(ExchangeCertificateRpc.SerializeObject(new object[] { ExchangeCertificateRpc.SerializeObject(RpcOutput.TaskErrorString), ExchangeCertificateRpc.SerializeObject(message), ExchangeCertificateRpc.SerializeObject(RpcOutput.TaskErrorCategory), ExchangeCertificateRpc.SerializeObject(category) })); } Dictionary <RpcOutput, object> dictionary = new Dictionary <RpcOutput, object>(); dictionary[RpcOutput.TaskErrorString] = message; dictionary[RpcOutput.TaskErrorCategory] = category; return(ExchangeCertificateRpc.SerializeObject(dictionary)); }
/// <summary> /// This method is used to generate and add a validation error message to the messages list. /// </summary> /// <param name="propertyName">Contains the property name error occurred.</param> /// <param name="message">Contains the resource key that will be used to look up the resource message value.</param> /// <param name="category">Contains the error message category.</param> public void Validation(string propertyName, string message, ErrorCategory category = ErrorCategory.General) { this.messages.Add(this.CreateValidationMessage(propertyName, this.resourceManager.GetString(message, this.culture) ?? message)); }
HostException(string message, Exception innerException, string errorId, ErrorCategory errorCategory) : base(message, innerException) { SetErrorId(errorId); SetErrorCategory(errorCategory); }
protected virtual void WriteError(Type exceptionType, string error, ErrorIds errorIds, ErrorCategory errorCategory, object targetObject, bool throwTerminatingError = false) { var exceptionInstance = (Exception)Activator.CreateInstance(exceptionType, error); WriteError(exceptionInstance, errorIds, errorCategory, targetObject, throwTerminatingError); }
/// <summary> /// This method is used to generate and add a validation error message to the messages list with a formatted message. /// </summary> /// <param name="propertyName">Contains the property name error occurred.</param> /// <param name="format">Contains the resource key that will be used to look up the resource message value.</param> /// <param name="category">Contains the error message category.</param> /// <param name="parameters">Contains one or more parameter values to insert into the formatted message.</param> public void ValidationFormat(string propertyName, string format, ErrorCategory category, params object[] parameters) { this.messages.Add(this.CreateValidationMessage(propertyName, string.Format(CultureInfo.InvariantCulture, this.resourceManager.GetString(format, this.culture) ?? format, parameters))); }
/// <summary> /// Creates a <see cref="PSGraphSDKException"/>. /// </summary> /// <param name="innerException">The inner exception</param> /// <param name="specificErrorId">The error ID which should be unique to this error type</param> /// <param name="errorCategory">The error category</param> /// <param name="targetObject">An object that can provide more debugging information (e.g. the object that caused the error)</param> internal PSGraphSDKException(Exception innerException, string specificErrorId, ErrorCategory errorCategory, object targetObject) : base(specificErrorId, innerException) { this.ErrorRecord = new ErrorRecord( innerException, ErrorPrefix + specificErrorId, errorCategory, targetObject); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); OrganizationId currentOrganizationId = base.CurrentOrganizationId; TDataObject dataObject = this.DataObject; if (!currentOrganizationId.Equals(dataObject.OrganizationId)) { this.CurrentOrgState = new LazilyInitialized <SharedTenantConfigurationState>(delegate() { TDataObject dataObject17 = this.DataObject; return(SharedConfiguration.GetSharedConfigurationState(dataObject17.OrganizationId)); }); } ADRecipient adrecipient = this.DataObject; bool flag = adrecipient != null && adrecipient.RecipientSoftDeletedStatus > 0; if (RecipientTaskHelper.IsMailEnabledRecipientType(this.DesiredRecipientType) && !flag) { if (!base.IsProvisioningLayerAvailable) { base.WriteError(new InvalidOperationException(Strings.ErrorNoProvisioningHandlerAvailable), (ErrorCategory)1001, null); } TDataObject dataObject2 = this.DataObject; if (dataObject2.IsModified(ADRecipientSchema.EmailAddresses)) { TDataObject dataObject3 = this.DataObject; if (dataObject3.EmailAddresses.Count > 0) { if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && this.ShouldCheckAcceptedDomains()) { IDirectorySession configurationSession = this.ConfigurationSession; TDataObject dataObject4 = this.DataObject; IConfigurationSession configurationSession2 = (IConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(configurationSession, dataObject4.OrganizationId, true); IConfigurationSession cfgSession = configurationSession2; TDataObject dataObject5 = this.DataObject; RecipientTaskHelper.ValidateSmtpAddress(cfgSession, dataObject5.EmailAddresses, this.DataObject, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache); } ADObjectId rootOrgContainerId = base.RootOrgContainerId; TDataObject dataObject6 = this.DataObject; ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, dataObject6.OrganizationId, base.ExecutingUserOrganizationId, false); IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, string.IsNullOrEmpty(base.DomainController) ? null : base.NetCredential, sessionSettings, 557, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\SetAdObjectTask.cs"); IRecipientSession tenantCatalogSession = tenantOrRootOrgRecipientSession; TDataObject dataObject7 = this.DataObject; RecipientTaskHelper.ValidateEmailAddressErrorOut(tenantCatalogSession, dataObject7.EmailAddresses, this.DataObject, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerReThrowDelegate(this.WriteError)); } } } TDataObject dataObject8 = this.DataObject; if (dataObject8.IsChanged(ADObjectSchema.Id)) { IDirectorySession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, null, base.OrgWideSessionSettings, ConfigScopes.TenantSubTree, 579, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\SetAdObjectTask.cs"); tenantOrTopologyConfigurationSession.UseConfigNC = ((IDirectorySession)base.DataSession).UseConfigNC; TDataObject dataObject9 = this.DataObject; ADObjectId parent = dataObject9.Id.Parent; ADRawEntry adrawEntry = tenantOrTopologyConfigurationSession.ReadADRawEntry(parent, new PropertyDefinition[] { ADObjectSchema.ExchangeVersion }); ExchangeObjectVersion exchangeObjectVersion = (ExchangeObjectVersion)adrawEntry[ADObjectSchema.ExchangeVersion]; TDataObject dataObject10 = this.DataObject; if (dataObject10.ExchangeVersion.IsOlderThan(exchangeObjectVersion)) { TDataObject dataObject11 = this.DataObject; string name = dataObject11.Name; TDataObject dataObject12 = this.DataObject; base.WriteError(new TaskException(Strings.ErrorParentHasNewerVersion(name, dataObject12.ExchangeVersion.ToString(), exchangeObjectVersion.ToString())), (ErrorCategory)1004, null); } } TDataObject dataObject13 = this.DataObject; if (dataObject13.RecipientType != this.DesiredRecipientType && this.DesiredRecipientType != RecipientType.Invalid) { TDataObject dataObject14 = this.DataObject; string id = dataObject14.Identity.ToString(); string oldType = this.DesiredRecipientType.ToString(); TDataObject dataObject15 = this.DataObject; Exception exception = new InvalidOperationException(Strings.ErrorSetTaskChangeRecipientType(id, oldType, dataObject15.RecipientType.ToString())); ErrorCategory category = (ErrorCategory)1000; TDataObject dataObject16 = this.DataObject; base.WriteError(exception, category, dataObject16.Identity); } base.InternalProcessRecord(); TaskLogger.LogExit(); }
internal static bool IsTaskError(this ErrorCategory cat) { return(System.Enum.IsDefined( typeof(Microsoft.VisualStudio.Shell.TaskErrorCategory), (int)cat)); }