using uCalcSoftware; var uc = new uCalc(); static void MyErrorHandler(Handle_uCalc h) { var uc = new uCalc(h); Console.WriteLine("--- Error Handler Caught ---"); Console.WriteLine($" Code: {(int)uc.Error.Code}"); Console.WriteLine($" Message: {uc.Error.Message}"); // Abort is the default response, no need to set it. } // Register the custom error handler uc.Error.AddHandler(MyErrorHandler); // Configure the engine to raise an error on overflow uc.Error.TrapOnOverflow = true; // This evaluation will now be intercepted by our handler Console.WriteLine("Evaluating expression '1e999'..."); uc.EvalStr("1e999"); // This triggers the callback Console.WriteLine("Evaluation finished.");