WF ThrowActivities 和自定义错误消息?

发布于 2024-07-09 00:13:16 字数 202 浏览 4 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

几味少女 2024-07-16 00:13:16

也许我不太明白你的问题,但是你可以在活动执行之前的任何地方使用 ThrowActivityFault 属性设置特定的异常,例如:

throwActivity1.Fault = new CustomException("This is my custom error message", myNumber, myObect);

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);
泅渡 2024-07-16 00:13:16

您可以像这样抛出任何自定义异常。

公共 DiscontinuedProductException 中止产品异常 1 = new DiscontinuedProductException();

[可序列化属性()]
公共类 DiscontinuedProductException :异常
{
公共停产产品异常()
: 根据()
{
}

    public DiscontinuedProductException(string message)
        : base(message)
    {
    }

    public DiscontinuedProductException(string message, Exception innerException)
        : base(message, innerException)
    {
    }

    protected DiscontinuedProductException(SerializationInfo info, StreamingContext context)
        : base(info, context)
    {
    }
}

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)
    {
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文