Catch and log function call error.

This commit is contained in:
hchen2020 2023-08-24 07:12:27 -05:00
parent 30814390dd
commit c8b9ce128f

View file

@ -29,9 +29,17 @@ public partial class ConversationService
await hook.OnFunctionExecuting(msg);
}
// Execute function
await fn.Execute(msg);
try
{
// Execute function
await fn.Execute(msg);
}
catch (Exception ex)
{
msg.ExecutionResult = ex.Message;
_logger.LogError(msg.ExecutionResult);
}
// After functions have been executed
foreach (var hook in hooks)
{