Transaction inside IFailuresPreprocessor

Transaction inside IFailuresPreprocessor

newbieng
Contributor Contributor
824 Views
1 Reply
Message 1 of 2

Transaction inside IFailuresPreprocessor

newbieng
Contributor
Contributor

Hi everybody,

my issue is referred to my previous post cannotMakeTypeError .

I'm using now the BuiltInFailures.FamilyFailures.CannotMakeType and I managed to avoid the message error on the screen, forcing the "failure" transaction to ProceedWithCommit; here's my succesful code for that:

 

public class TypeErrorSwallower : IFailuresPreprocessor
{
	public FailureProcessingResult PreprocessFailures(FailuresAccessor a)
	{
		IList<FailureMessageAccessor> failures = a.GetFailureMessages();
		 
		foreach( FailureMessageAccessor f in failures )
		{ 
		    FailureDefinitionId id = f.GetFailureDefinitionId();
		    if( BuiltInFailures.FamilyFailures.CannotMakeTypeCB == id )
		    {
		    	return FailureProcessingResult.ProceedWithCommit;
		    }
		 }
		 return FailureProcessingResult.Continue;
	}
}

What I'm asking now, is if it's possible to make changes to the model when it goes into the PreprocessFailure: suppose that I have a transaction setting the L parameter and a value is causing the failure because it can't make any type, I would change the value of that parameter and then go on with the rest of the code...

 

I tried to insert a new transaction within the FailurePreprocessor but when I debug the code I found that the Set() causes a new error and no change is executed, I've attached a very simple file with a test-family (made only to reproduce the error) and my code: someone can help me with this?

Is it possible set a parameter to a different value when it comes to the preprocessFailure?

 

Thanks in advance

 

 

 

Accepted solutions (1)
825 Views
1 Reply
Reply (1)
Message 2 of 2

RPTHOMAS108
Mentor
Mentor
Accepted solution

Not possible. You have to commit transaction and then decide what to do about failure.

 

During failure processing you may roll back transaction, pick a resolution predefined for the type of failure encountered or remove warnings. The process then repeats.