Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/DurableTask.Core/FailureDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,10 @@ public bool IsCausedBy<T>() where T : Exception
.Select(a => a.GetType(this.ErrorType, throwOnError: false))
.Where(t => t is not null)
.ToList();
if (matchingExceptionTypes.Count == 1)
{
exceptionType = matchingExceptionTypes[0];
}
else if (matchingExceptionTypes.Count > 1)
{
throw new AmbiguousMatchException($"Multiple exception types with the name '{this.ErrorType}' were found.");
}

// Previously, this logic would only return true if matchingExceptionTypes found only one assembly with a type matching ErrorType.
// Now, it will return true if any matching assembly has a type that is assignable to T.
return matchingExceptionTypes.Any(matchType => typeof(T).IsAssignableFrom(matchType));
}

return exceptionType != null && typeof(T).IsAssignableFrom(exceptionType);
Expand Down
Loading