Property Error
Error
Gets the exception that caused execution to fail, if applicable.
public Exception Error { get; }
Property Value
Examples
Handling execution errors:
using LMKit.Model;
using LMKit.Agents;
using var model = new LM("path/to/model.gguf");
var agent = new Agent(model);
var result = agent.Run("Process this request.");
if (result.IsFailed)
{
Console.WriteLine($"Execution failed: {result.Error.Message}");
// Log full exception for debugging
if (result.Error.InnerException != null)
{
Console.WriteLine($"Inner: {result.Error.InnerException.Message}");
}
// Partial content might still be available
if (!string.IsNullOrEmpty(result.Content))
{
Console.WriteLine($"Partial response: {result.Content}");
}
}