Skip to content

Commit a1d70d2

Browse files
authored
.Net Fix - Display thread type name in error message (#12723)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> Error message confusing ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Error message does not display thread type and instead displays the name of the generic parameter: `Microsoft.SemanticKernel.KernelException: OpenAIResponseAgent currently only supports agent threads of type TThreadType.` (Customer reported an error using the erroneous error message.) ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
1 parent 190954a commit a1d70d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dotnet/src/Agents/Abstractions/Agent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ protected virtual async Task<TThreadType> EnsureThreadExistsWithMessagesAsync<TT
350350

351351
if (thread is not TThreadType concreteThreadType)
352352
{
353-
throw new KernelException($"{this.GetType().Name} currently only supports agent threads of type {nameof(TThreadType)}.");
353+
throw new KernelException($"{this.GetType().Name} currently only supports agent threads of type {typeof(TThreadType).Name}.");
354354
}
355355

356356
// We have to explicitly call create here to ensure that the thread is created

0 commit comments

Comments
 (0)