ThrowActivities WF ورسائل الخطأ المخصصة؟
-
08-07-2019 - |
سؤال
وأنه من الممكن لرمي رسالة خطأ مخصصة لThrowActivity، في الأساس النوافذ سير العمل؟
وعلى سبيل المثال. تخيل أريد أن رمي هذا الاستثناء، في بلدي WF: -
CutomException("This is my custom error message", myNumber, myObect);
وهتافات:)
المحلول
وربما أنا لا أفهم سؤالك جيدا، ولكن يمكنك تعيين استثناء محدد مع الخاصية Fault
من ThrowActivity
في أي مكان قبل تنفيذ النشاط، منها مثلا:
throwActivity1.Fault = new CustomException("This is my custom error message", myNumber, myObect);
نصائح أخرى
ويمكنك رمي أي استثناء مخصصة مثل هذه الطريقة.
والجمهور DiscontinuedProductException discontinuedProductException1 = DiscontinuedProductException جديدة ()؛
[SerializableAttribute ()] 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)
{
}
}
لا تنتمي إلى StackOverflow