public void WriteXml(XmlWriter writer) { if (!string.IsNullOrWhiteSpace(GroupName)) { writer.WriteAttributeString("GroupName", GroupName); } if (GroupIndex != 0) { writer.WriteAttributeString("GroupIndex", GroupIndex.ToString(CultureInfo.InvariantCulture)); } writer.WriteElementString("Type", Type.ToString()); writer.WriteElementString("Label", Label); writer.WriteElementString("Variable", Variable); writer.WriteElementString("Operator", Operator); writer.WriteElementString("Value", Value); writer.WriteElementString("HasError", HasError.ToString()); writer.WriteElementString("TestStepHasError", TestStepHasError.ToString()); writer.WriteElementString("MockSelected", MockSelected.ToString()); if (!string.IsNullOrWhiteSpace(MoreLink)) { writer.WriteElementString("MoreLink", MoreLink); } }
/// <summary> /// Стандартный метод запуска основной бизнес-логики действия процесса. /// </summary> /// <param name="executionContext">Контекста выполенения действия процесса.</param> protected override void Execute(CodeActivityContext executionContext) { var context = new Context(executionContext); try { if (_firstExecute) { try { Configuring(context); _firstExecute = false; } catch (Exception ex) { throw new WorkflowConfigurationException("System component setting error.\n Please contact support.", ex); } } Execute(context); } catch (WorkflowConfigurationException ex) { TraceException(context, ex); if (!HasError.Get(executionContext)) { SetError(context, ex.Message); } if (ThrowException.Get(context)) { throw; } } catch (InvalidWorkflowExecutionException ex) { TraceException(context, ex); if (!HasError.Get(executionContext)) { SetError(context, ex.Message); } if (ThrowException.Get(context)) { throw; } } catch (Exception ex) { TraceException(context, ex); if (!HasError.Get(executionContext)) { SetError(context, ex.Message); } if (ThrowException.Get(context)) { throw new InvalidWorkflowExecutionException("An unexpected system error.\n Please contact support.", ex); } } }
/// <summary> /// Установка значения ошибки выполнения. /// </summary> /// <param name="context">Конекст выполнения.</param> /// <param name="message">Сообщение об ошибке.</param> /// <exception cref="Exception">Вызывается если параметр <see cref="ThrowException"/> установлен в <c>true</c>.</exception> protected virtual void SetError(Context context, string message) { HasError.Set(context, true); ErrorMessage.Set(context, message); if (ThrowException.Get(context)) { throw new InvalidWorkflowExecutionException(message); } }
public void TestShouldCancelLoadingIfAnErrorIsDetected() { HasError error = new HasError(); try { error.Load(); Assert.Fail(); } catch (CustomException) { // This is expected } }
private void CheckError() { if (HasError.ContainsValue(true)) { this.doneBtn.BackColor = Color.FromArgb(30, 30, 30); this.doneBtn.ForeColor = Color.FromArgb(200, 200, 200); this.doneBtn.Enabled = false; } else { this.doneBtn.BackColor = Color.FromArgb(67, 67, 70); this.doneBtn.ForeColor = Color.White; this.doneBtn.Enabled = true; } }
public static bool HandledError(HasError r, string errorNotification, bool debug = false) { if (string.IsNullOrEmpty(r.error)) { return(false); } #if UNITY_EDITOR || DEBUG_UNSTRIP Debug.LogWarning("[" + Time.frameCount + "] error loading : " + r.error); #endif NotificationBus.Send(errorNotification, new ResolveFailedDTO { error = r }); return(true); }
public override int GetHashCode() { unchecked { var hashCode = (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ HasError.GetHashCode(); hashCode = (hashCode * 397) ^ (ErrorMessage != null ? ErrorMessage.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsEditable.GetHashCode(); hashCode = (hashCode * 397) ^ IsVisible.GetHashCode(); hashCode = (hashCode * 397) ^ IsSelected.GetHashCode(); hashCode = (hashCode * 397) ^ IsUsed.GetHashCode(); hashCode = (hashCode * 397) ^ AllowNotes.GetHashCode(); hashCode = (hashCode * 397) ^ IsComplexObject.GetHashCode(); hashCode = (hashCode * 397) ^ (DisplayName != null ? DisplayName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)ColumnIODirection; hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); return(hashCode); } }
void SetValues(NativeActivityContext context, bool whereErrors) { Result.Set(context, whereErrors); HasError.Set(context, whereErrors); IsValid.Set(context, whereErrors); }
public void WriteXml(XmlWriter writer) { //------Always log these for reconstruction------------ writer.WriteAttributeString("DisplayName", DisplayName); writer.WriteAttributeString("ID", ID.ToString()); writer.WriteAttributeString("OriginalInstanceID", OriginalInstanceID.ToString()); writer.WriteAttributeString("ParentID", ParentID.ToString()); writer.WriteAttributeString("ServerID", ServerID.ToString()); writer.WriteAttributeString("StateType", StateType.ToString()); writer.WriteElementString("HasError", HasError.ToString()); writer.WriteAttributeString("SessionID", SessionID.ToString()); if (HasError) { writer.WriteElementString("ErrorMessage", ErrorMessage); } //----------------------------- var settings = WorkflowLoggger.LoggingSettings; //Version if (settings.IsVersionLogged && !string.IsNullOrWhiteSpace(Version)) { writer.WriteElementString("Version", Version); } //Type if (settings.IsTypeLogged) { writer.WriteElementString("Name", Name); writer.WriteElementString("ActivityType", ActivityType.ToString()); } //Duration if (settings.IsDurationLogged) { if (Duration != default(TimeSpan)) { writer.WriteElementString("Duration", DurationString); } } //DateTime if (settings.IsDataAndTimeLogged) { if (StartTime != DateTime.MinValue) { writer.WriteElementString("StartTime", StartTime.ToString("G")); } if (EndTime != DateTime.MinValue) { writer.WriteElementString("EndTime", EndTime.ToString("G")); } } //Input if (settings.IsInputLogged && Inputs.Count > 0) { writer.WriteStartElement("Inputs"); writer.WriteAttributeString("Count", Inputs.Count.ToString(CultureInfo.InvariantCulture)); var inputSer = new XmlSerializer(typeof(DebugItem)); foreach (var other in Inputs) { inputSer.Serialize(writer, other); } writer.WriteEndElement(); } //Output if (settings.IsOutputLogged && Outputs.Count > 0) { writer.WriteStartElement("Outputs"); writer.WriteAttributeString("Count", Outputs.Count.ToString(CultureInfo.InvariantCulture)); var outputSer = new XmlSerializer(typeof(DebugItem)); foreach (var other in Outputs) { outputSer.Serialize(writer, other); } writer.WriteEndElement(); } //StartBlock if (IsFirstStep()) { if (ExecutionOrigin != ExecutionOrigin.Unknown) { writer.WriteElementString("ExecutionOrigin", ExecutionOrigin.ToString()); } if (!string.IsNullOrWhiteSpace(ExecutingUser)) { writer.WriteElementString("ExecutingUser", ExecutingUser); } } //EndBlock if (IsFinalStep()) { writer.WriteElementString("NumberOfSteps", NumberOfSteps.ToString(CultureInfo.InvariantCulture)); } }
protected void OnHasError(string message) { // Check if there are any Subscribers // Call the Event HasError?.Invoke(message); }
/// <summary> /// Writes instance members into the given <paramref name="dictionary"/> to store them as BYAML data. /// </summary> /// <param name="dictionary">The <see cref="Dictionary{String, Object}"/> to store the data in.</param> public void SerializeByaml(IDictionary <string, object> dictionary) { dictionary["hasError"] = HasError.ToString(); }
protected override void OnExecute(NativeActivityContext context) { // ???? Why is this here.... context.Properties.ToObservableCollection(); IEsbChannel esbChannel = context.GetExtension <IEsbChannel>(); IDSFDataObject dataObject = context.GetExtension <IDSFDataObject>(); IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); ErrorResultTO errors; ErrorResultTO allErrors = new ErrorResultTO(); Guid datalistId = DataListExecutionID.Get(context); ParentServiceName = dataObject.ServiceName; ParentWorkflowInstanceId = context.WorkflowInstanceId.ToString(); string parentServiceName = string.Empty; string serviceName = string.Empty; // BUG 9634 - 2013.07.17 - TWR - changed isRemoteExecution to check EnvironmentID instead // This is now the wrong behavior - We need to keep the original EnvironmentID when not a remote workflow // This is because we put and empty GUID in when designing against a remote server that uses it's resources // The first time through this value is set correctly when executing those designed resource from our localhost // If we change it as per what was here, we always get a localhost tag instead of the remote host we are design against var isRemote = dataObject.IsRemoteWorkflow(); dataObject.EnvironmentID = context.GetValue(EnvironmentID); if ((isRemote || dataObject.IsRemoteInvokeOverridden) && dataObject.EnvironmentID == Guid.Empty) { dataObject.IsRemoteInvokeOverridden = true; } var oldResourceId = dataObject.ResourceID; InitializeDebug(dataObject); try { compiler.ClearErrors(dataObject.DataListID); if (ServiceServer != Guid.Empty) { // we need to adjust the originating server id so debug reflect remote server instead of localhost ;) dataObject.RemoteInvokerID = ServiceServer.ToString(); } dataObject.RemoteServiceType = context.GetValue(Type); dataObject.RunWorkflowAsync = RunWorkflowAsync; if (dataObject.IsDebugMode() || (dataObject.RunWorkflowAsync && !dataObject.IsFromWebServer)) { DispatchDebugState(context, StateType.Before); } var resourceId = context.GetValue(ResourceID); if (resourceId != Guid.Empty) { dataObject.ResourceID = resourceId; } // scrub it clean ;) ScrubDataList(compiler, datalistId, context.WorkflowInstanceId.ToString(), out errors); allErrors.MergeErrors(errors); // set the parent service parentServiceName = dataObject.ParentServiceName; serviceName = dataObject.ServiceName; dataObject.ParentServiceName = serviceName; _previousInstanceId = dataObject.ParentInstanceID; dataObject.ParentID = oldResourceId; dataObject.ParentInstanceID = UniqueID; dataObject.ParentWorkflowInstanceId = ParentWorkflowInstanceId; if (!DeferExecution) { // In all cases the ShapeOutput will have merged the execution data up into the current ErrorResultTO tmpErrors = new ErrorResultTO(); if (esbChannel == null) { throw new Exception("FATAL ERROR : Null ESB channel!!"); } else { // NEW EXECUTION MODEL ;) // PBI 7913 if (datalistId != GlobalConstants.NullDataListID) { BeforeExecutionStart(dataObject, allErrors); allErrors.MergeErrors(tmpErrors); dataObject.ServiceName = ServiceName; // set up for sub-exection ;) dataObject.ResourceID = ResourceID.Expression == null ? Guid.Empty : Guid.Parse(ResourceID.Expression.ToString()); // Execute Request ExecutionImpl(esbChannel, dataObject, InputMapping, OutputMapping, out tmpErrors); allErrors.MergeErrors(tmpErrors); AfterExecutionCompleted(tmpErrors); allErrors.MergeErrors(tmpErrors); dataObject.DataListID = datalistId; // re-set DL ID dataObject.ServiceName = ServiceName; } // ** THIS IS A HACK OF NOTE, WE NEED TO ADDRESS THIS! if (dataObject.IsDebugMode()) { //Dont remove this it is here to fix the data not being returned correctly string testData = compiler.ConvertFrom(dataObject.DataListID, DataListFormat.CreateFormat(GlobalConstants._Studio_Debug_XML), enTranslationDepth.Data, out errors).ToString(); if (string.IsNullOrEmpty(testData)) { } } } bool whereErrors = compiler.HasErrors(datalistId); Result.Set(context, whereErrors); HasError.Set(context, whereErrors); IsValid.Set(context, whereErrors); } } finally { if (!dataObject.WorkflowResumeable || !dataObject.IsDataListScoped) { // Handle Errors if (allErrors.HasErrors()) { DisplayAndWriteError("DsfActivity", allErrors); compiler.UpsertSystemTag(dataObject.DataListID, enSystemTag.Dev2Error, allErrors.MakeDataListReady(), out errors); // add to datalist in variable specified if (!String.IsNullOrEmpty(OnErrorVariable)) { var upsertVariable = DataListUtil.AddBracketsToValueIfNotExist(OnErrorVariable); compiler.Upsert(dataObject.DataListID, upsertVariable, allErrors.MakeDataListReady(), out errors); } } } if (dataObject.IsDebugMode() || (dataObject.RunWorkflowAsync && !dataObject.IsFromWebServer)) { DispatchDebugState(context, StateType.After); } dataObject.ParentInstanceID = _previousInstanceId; dataObject.ParentServiceName = parentServiceName; dataObject.ServiceName = serviceName; dataObject.RemoteInvokeResultShape = new StringBuilder(); // reset targnet shape ;) dataObject.RunWorkflowAsync = false; dataObject.RemoteInvokerID = Guid.Empty.ToString(); dataObject.EnvironmentID = Guid.Empty; dataObject.ResourceID = oldResourceId; } }