using uCalcSoftware;

var uc = new uCalc();

static void MyHandler(Handle_uCalc h) {
   var uc = new uCalc(h);
   // This handler just logs the error and aborts
   Console.WriteLine($"Error Handler Caught: {uc.Error.Message}");
}
static void MyFunc(uCalc.Callback cb) {
   // This function always fails with a custom message
   cb.Error.Raise("Validation failed for input.");
}

uc.Error.AddHandler(MyHandler);
uc.DefineFunction("Validate()", MyFunc);
uc.EvalStr("Validate()"); // This call will trigger the error