using uCalcSoftware; var uc = new uCalc(); static void MyHandler(Handle_uCalc h) { var uc = new uCalc(h); // Retrieve the error code as an integer for display int code = (int)uc.Error.Code; Console.WriteLine($"Caught Error Code: {code}"); // Compare the error code against the ErrorCode enum for logic if (uc.Error.Code == ErrorCode.Syntax_Error) { Console.WriteLine("This was a syntax error."); } } // Register the error handler uc.Error.AddHandler(MyHandler); // Intentionally cause a syntax error, which will trigger the handler Console.WriteLine(uc.EvalStr("5 *"));