Update ActivityNotFoundActivity to throw exception when executed
This commit is contained in:
parent
2b34f1d72c
commit
591fdd670b
|
|
@ -1,6 +1,7 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Elsa.Workflows.Core.Attributes;
|
||||
using Elsa.Workflows.Core.Exceptions;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Elsa.Workflows.Core.Activities;
|
||||
|
|
@ -38,4 +39,10 @@ public class NotFoundActivity : CodeActivity
|
|||
/// The original activity JSON.
|
||||
/// </summary>
|
||||
public string OriginalActivityJson { get; set; } = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Execute(ActivityExecutionContext context)
|
||||
{
|
||||
throw new ActivityNotFoundException(MissingTypeName, MissingTypeVersion);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
namespace Elsa.Workflows.Core.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Thrown when a NotFoundActivity is executed.
|
||||
/// </summary>
|
||||
public class ActivityNotFoundException : Exception
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ActivityNotFoundException(string missingTypeName, int missingTypeVersion) : base($"Activity type '{missingTypeName}' version '{missingTypeVersion}' could not be found.")
|
||||
{
|
||||
MissingTypeName = missingTypeName;
|
||||
MissingTypeVersion = missingTypeVersion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The type name of the missing activity type.
|
||||
/// </summary>
|
||||
public string MissingTypeName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The version of the missing activity type.
|
||||
/// </summary>
|
||||
public int MissingTypeVersion { get; }
|
||||
}
|
||||
Loading…
Reference in a new issue