WF ThrowActivities and custom error messages?
-
08-07-2019 - |
Question
is it possible to throw a custom error message to a ThrowActivity, in windows workflow foundation?
eg. Imagine i want to throw this exception, in my WF :-
CutomException("This is my custom error message", myNumber, myObect);
cheers :)
Solution
Maybe I do not understand your question well, but you can set the specific exception with the Fault
property of ThrowActivity
in any place before the activity execution, e.g.:
throwActivity1.Fault = new CustomException("This is my custom error message", myNumber, myObect);
OTHER TIPS
You can throw any custom exception like this way.
public DiscontinuedProductException discontinuedProductException1 = new DiscontinuedProductException();
[SerializableAttribute()] public class DiscontinuedProductException : Exception { public DiscontinuedProductException() : base() { }
public DiscontinuedProductException(string message)
: base(message)
{
}
public DiscontinuedProductException(string message, Exception innerException)
: base(message, innerException)
{
}
protected DiscontinuedProductException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow