WF ThrowActivities 和自定义错误消息?
在 Windows 工作流基础中,是否可以向 ThrowActivity 抛出自定义错误消息?
例如。 想象一下我想在我的 WF 中抛出这个异常:-
CutomException("This is my custom error message", myNumber, myObect);
干杯:)
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 :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许我不太明白你的问题,但是你可以在活动执行之前的任何地方使用
ThrowActivity
的Fault
属性设置特定的异常,例如:Maybe I do not understand your question well, but you can set the specific exception with the
Fault
property ofThrowActivity
in any place before the activity execution, e.g.:您可以像这样抛出任何自定义异常。
公共 DiscontinuedProductException 中止产品异常 1 = new DiscontinuedProductException();
[可序列化属性()]
公共类 DiscontinuedProductException :异常
{
公共停产产品异常()
: 根据()
{
}
You can throw any custom exception like this way.
public DiscontinuedProductException discontinuedProductException1 = new DiscontinuedProductException();
[SerializableAttribute()]
public class DiscontinuedProductException : Exception
{
public DiscontinuedProductException()
: base()
{
}