Imports System
Imports uCalcSoftware
Public Module Program
   
   Public Sub MyHandler(ByVal h As Handle_uCalc)
      Dim uc As New uCalc(h)
      '// This handler just logs the error and aborts
      Console.WriteLine($"Error Handler Caught: {uc.Error.Message}")
   End Sub
   Public Sub MyFunc(ByVal cb As uCalc.Callback)
      '// This function always fails with a custom message
      cb.Error.Raise("Validation failed for input.")
   End Sub
   Public Sub Main()
      Dim uc As New uCalc()
      uc.Error.AddHandler(AddressOf MyHandler)
      uc.DefineFunction("Validate()", AddressOf MyFunc)
      uc.EvalStr("Validate()") '// This call will trigger the error
   End Sub
End Module