uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Product:
Class:
ID: 39
using uCalcSoftware;
var uc = new uCalc();
static void RaiseErrorMessageCallback(uCalc.Callback cb) {
if (cb.Arg(1) == 123) {
cb.Error.Raise("I do not like this value!");
cb.Return(cb.Arg(1));
}
}
uc.DefineFunction("ErrRaiseMsgTest(Value)", RaiseErrorMessageCallback);
Console.WriteLine(uc.EvalStr("ErrRaiseMsgTest(111)"));
Console.WriteLine(uc.EvalStr("ErrRaiseMsgTest(123)"));
111
I do not like this value! using uCalcSoftware; var uc = new uCalc(); static void RaiseErrorMessageCallback(uCalc.Callback cb) { if (cb.Arg(1) == 123) { cb.Error.Raise("I do not like this value!"); cb.Return(cb.Arg(1)); } } uc.DefineFunction("ErrRaiseMsgTest(Value)", RaiseErrorMessageCallback); Console.WriteLine(uc.EvalStr("ErrRaiseMsgTest(111)")); Console.WriteLine(uc.EvalStr("ErrRaiseMsgTest(123)"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
void ucalc_call RaiseErrorMessageCallback(uCalcBase::Callback cb) {
if (cb.Arg(1) == 123) {
cb.Error().Raise("I do not like this value!");
cb.Return(cb.Arg(1));
}
}
int main() {
uCalc uc;
uc.DefineFunction("ErrRaiseMsgTest(Value)", RaiseErrorMessageCallback);
cout << uc.EvalStr("ErrRaiseMsgTest(111)") << endl;
cout << uc.EvalStr("ErrRaiseMsgTest(123)") << endl;
}
111
I do not like this value! #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call RaiseErrorMessageCallback(uCalcBase::Callback cb) { if (cb.Arg(1) == 123) { cb.Error().Raise("I do not like this value!"); cb.Return(cb.Arg(1)); } } int main() { uCalc uc; uc.DefineFunction("ErrRaiseMsgTest(Value)", RaiseErrorMessageCallback); cout << uc.EvalStr("ErrRaiseMsgTest(111)") << endl; cout << uc.EvalStr("ErrRaiseMsgTest(123)") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub RaiseErrorMessageCallback(ByVal cb As uCalc.Callback)
If cb.Arg(1) = 123 Then
cb.Error.Raise("I do not like this value!")
cb.Return(cb.Arg(1))
End If
End Sub
Public Sub Main()
Dim uc As New uCalc()
uc.DefineFunction("ErrRaiseMsgTest(Value)", AddressOf RaiseErrorMessageCallback)
Console.WriteLine(uc.EvalStr("ErrRaiseMsgTest(111)"))
Console.WriteLine(uc.EvalStr("ErrRaiseMsgTest(123)"))
End Sub
End Module
111
I do not like this value! Imports System Imports uCalcSoftware Public Module Program Public Sub RaiseErrorMessageCallback(ByVal cb As uCalc.Callback) If cb.Arg(1) = 123 Then cb.Error.Raise("I do not like this value!") cb.Return(cb.Arg(1)) End If End Sub Public Sub Main() Dim uc As New uCalc() uc.DefineFunction("ErrRaiseMsgTest(Value)", AddressOf RaiseErrorMessageCallback) Console.WriteLine(uc.EvalStr("ErrRaiseMsgTest(111)")) Console.WriteLine(uc.EvalStr("ErrRaiseMsgTest(123)")) End Sub End Module
ID: 482
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
Error Handler Caught: Validation failed for input. 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
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
void ucalc_call MyHandler(Handle_uCalc h) {
auto uc = uCalc(h);
// This handler just logs the error and aborts
cout << "Error Handler Caught: " << uc.Error().Message() << endl;
}
void ucalc_call MyFunc(uCalcBase::Callback cb) {
// This function always fails with a custom message
cb.Error().Raise("Validation failed for input.");
}
int main() {
uCalc uc;
uc.Error().AddHandler(MyHandler);
uc.DefineFunction("Validate()", MyFunc);
uc.EvalStr("Validate()"); // This call will trigger the error
}
Error Handler Caught: Validation failed for input. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call MyHandler(Handle_uCalc h) { auto uc = uCalc(h); // This handler just logs the error and aborts cout << "Error Handler Caught: " << uc.Error().Message() << endl; } void ucalc_call MyFunc(uCalcBase::Callback cb) { // This function always fails with a custom message cb.Error().Raise("Validation failed for input."); } int main() { uCalc uc; uc.Error().AddHandler(MyHandler); uc.DefineFunction("Validate()", MyFunc); uc.EvalStr("Validate()"); // This call will trigger the error }
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
Error Handler Caught: Validation failed for input. 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
ID: 483
using uCalcSoftware;
var uc = new uCalc();
static void ValidateValue(uCalc.Callback cb) {
var val = cb.Arg(1);
if (val > 100) {
// The error message includes the problematic value, making it dynamic.
cb.Error.Raise("Value exceeds maximum of 100. Got: " + val.ToString());
} else {
cb.Return(val);
}
}
uc.DefineFunction("CheckValue(val)", ValidateValue);
Console.WriteLine(uc.EvalStr("CheckValue(50)"));
Console.WriteLine(uc.EvalStr("CheckValue(123)"));
50
Value exceeds maximum of 100. Got: 123 using uCalcSoftware; var uc = new uCalc(); static void ValidateValue(uCalc.Callback cb) { var val = cb.Arg(1); if (val > 100) { // The error message includes the problematic value, making it dynamic. cb.Error.Raise("Value exceeds maximum of 100. Got: " + val.ToString()); } else { cb.Return(val); } } uc.DefineFunction("CheckValue(val)", ValidateValue); Console.WriteLine(uc.EvalStr("CheckValue(50)")); Console.WriteLine(uc.EvalStr("CheckValue(123)"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
void ucalc_call ValidateValue(uCalcBase::Callback cb) {
auto val = cb.Arg(1);
if (val > 100) {
// The error message includes the problematic value, making it dynamic.
cb.Error().Raise("Value exceeds maximum of 100. Got: " + to_string((int)val));
} else {
cb.Return(val);
}
}
int main() {
uCalc uc;
uc.DefineFunction("CheckValue(val)", ValidateValue);
cout << uc.EvalStr("CheckValue(50)") << endl;
cout << uc.EvalStr("CheckValue(123)") << endl;
}
50
Value exceeds maximum of 100. Got: 123 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call ValidateValue(uCalcBase::Callback cb) { auto val = cb.Arg(1); if (val > 100) { // The error message includes the problematic value, making it dynamic. cb.Error().Raise("Value exceeds maximum of 100. Got: " + to_string((int)val)); } else { cb.Return(val); } } int main() { uCalc uc; uc.DefineFunction("CheckValue(val)", ValidateValue); cout << uc.EvalStr("CheckValue(50)") << endl; cout << uc.EvalStr("CheckValue(123)") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub ValidateValue(ByVal cb As uCalc.Callback)
Dim val = cb.Arg(1)
If val > 100 Then
'// The error message includes the problematic value, making it dynamic.
cb.Error.Raise("Value exceeds maximum of 100. Got: " + val.ToString())
Else
cb.Return(val)
End If
End Sub
Public Sub Main()
Dim uc As New uCalc()
uc.DefineFunction("CheckValue(val)", AddressOf ValidateValue)
Console.WriteLine(uc.EvalStr("CheckValue(50)"))
Console.WriteLine(uc.EvalStr("CheckValue(123)"))
End Sub
End Module
50
Value exceeds maximum of 100. Got: 123 Imports System Imports uCalcSoftware Public Module Program Public Sub ValidateValue(ByVal cb As uCalc.Callback) Dim val = cb.Arg(1) If val > 100 Then '// The error message includes the problematic value, making it dynamic. cb.Error.Raise("Value exceeds maximum of 100. Got: " + val.ToString()) Else cb.Return(val) End If End Sub Public Sub Main() Dim uc As New uCalc() uc.DefineFunction("CheckValue(val)", AddressOf ValidateValue) Console.WriteLine(uc.EvalStr("CheckValue(50)")) Console.WriteLine(uc.EvalStr("CheckValue(123)")) End Sub End Module
ID: 484
using uCalcSoftware;
var uc = new uCalc();
static void RecoveryHandler(Handle_uCalc h) {
var uc = new uCalc(h);
Console.WriteLine($"Handler: Caught '{uc.Error.Message}'");
// Attempt to recover by resuming execution.
uc.Error.Response = ErrorHandlerResponse.Resume;
Console.WriteLine("Handler: Resuming execution...");
}
static void RiskyOperation(uCalc.Callback cb) {
var input = cb.ArgStr(1);
if (input == "bad") {
cb.Error.Raise("A recoverable error occurred.");
// After the error handler resumes, this return value will be used.
} else {
cb.ReturnStr("Normal_OK");
}
}
uc.Error.AddHandler(RecoveryHandler);
uc.DefineFunction("DoWork(s As String) As String", RiskyOperation);
Console.WriteLine("Result: " + uc.EvalStr("DoWork('good')"));
Console.WriteLine("---");
Console.WriteLine("Result: " + uc.EvalStr("DoWork('bad')"));
Result: Normal_OK
---
Handler: Caught 'A recoverable error occurred.'
Handler: Resuming execution...
Result: A recoverable error occurred. using uCalcSoftware; var uc = new uCalc(); static void RecoveryHandler(Handle_uCalc h) { var uc = new uCalc(h); Console.WriteLine($"Handler: Caught '{uc.Error.Message}'"); // Attempt to recover by resuming execution. uc.Error.Response = ErrorHandlerResponse.Resume; Console.WriteLine("Handler: Resuming execution..."); } static void RiskyOperation(uCalc.Callback cb) { var input = cb.ArgStr(1); if (input == "bad") { cb.Error.Raise("A recoverable error occurred."); // After the error handler resumes, this return value will be used. } else { cb.ReturnStr("Normal_OK"); } } uc.Error.AddHandler(RecoveryHandler); uc.DefineFunction("DoWork(s As String) As String", RiskyOperation); Console.WriteLine("Result: " + uc.EvalStr("DoWork('good')")); Console.WriteLine("---"); Console.WriteLine("Result: " + uc.EvalStr("DoWork('bad')"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
void ucalc_call RecoveryHandler(Handle_uCalc h) {
auto uc = uCalc(h);
cout << "Handler: Caught '" << uc.Error().Message() << "'" << endl;
// Attempt to recover by resuming execution.
uc.Error().Response(ErrorHandlerResponse::Resume);
cout << "Handler: Resuming execution..." << endl;
}
void ucalc_call RiskyOperation(uCalcBase::Callback cb) {
auto input = cb.ArgStr(1);
if (input == "bad") {
cb.Error().Raise("A recoverable error occurred.");
// After the error handler resumes, this return value will be used.
} else {
cb.ReturnStr("Normal_OK");
}
}
int main() {
uCalc uc;
uc.Error().AddHandler(RecoveryHandler);
uc.DefineFunction("DoWork(s As String) As String", RiskyOperation);
cout << "Result: " + uc.EvalStr("DoWork('good')") << endl;
cout << "---" << endl;
cout << "Result: " + uc.EvalStr("DoWork('bad')") << endl;
}
Result: Normal_OK
---
Handler: Caught 'A recoverable error occurred.'
Handler: Resuming execution...
Result: A recoverable error occurred. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call RecoveryHandler(Handle_uCalc h) { auto uc = uCalc(h); cout << "Handler: Caught '" << uc.Error().Message() << "'" << endl; // Attempt to recover by resuming execution. uc.Error().Response(ErrorHandlerResponse::Resume); cout << "Handler: Resuming execution..." << endl; } void ucalc_call RiskyOperation(uCalcBase::Callback cb) { auto input = cb.ArgStr(1); if (input == "bad") { cb.Error().Raise("A recoverable error occurred."); // After the error handler resumes, this return value will be used. } else { cb.ReturnStr("Normal_OK"); } } int main() { uCalc uc; uc.Error().AddHandler(RecoveryHandler); uc.DefineFunction("DoWork(s As String) As String", RiskyOperation); cout << "Result: " + uc.EvalStr("DoWork('good')") << endl; cout << "---" << endl; cout << "Result: " + uc.EvalStr("DoWork('bad')") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub RecoveryHandler(ByVal h As Handle_uCalc)
Dim uc As New uCalc(h)
Console.WriteLine($"Handler: Caught '{uc.Error.Message}'")
'// Attempt to recover by resuming execution.
uc.Error.Response = ErrorHandlerResponse.Resume
Console.WriteLine("Handler: Resuming execution...")
End Sub
Public Sub RiskyOperation(ByVal cb As uCalc.Callback)
Dim input = cb.ArgStr(1)
If input = "bad" Then
cb.Error.Raise("A recoverable error occurred.")
'// After the error handler resumes, this return value will be used.
Else
cb.ReturnStr("Normal_OK")
End If
End Sub
Public Sub Main()
Dim uc As New uCalc()
uc.Error.AddHandler(AddressOf RecoveryHandler)
uc.DefineFunction("DoWork(s As String) As String", AddressOf RiskyOperation)
Console.WriteLine("Result: " + uc.EvalStr("DoWork('good')"))
Console.WriteLine("---")
Console.WriteLine("Result: " + uc.EvalStr("DoWork('bad')"))
End Sub
End Module
Result: Normal_OK
---
Handler: Caught 'A recoverable error occurred.'
Handler: Resuming execution...
Result: A recoverable error occurred. Imports System Imports uCalcSoftware Public Module Program Public Sub RecoveryHandler(ByVal h As Handle_uCalc) Dim uc As New uCalc(h) Console.WriteLine($"Handler: Caught '{uc.Error.Message}'") '// Attempt to recover by resuming execution. uc.Error.Response = ErrorHandlerResponse.Resume Console.WriteLine("Handler: Resuming execution...") End Sub Public Sub RiskyOperation(ByVal cb As uCalc.Callback) Dim input = cb.ArgStr(1) If input = "bad" Then cb.Error.Raise("A recoverable error occurred.") '// After the error handler resumes, this return value will be used. Else cb.ReturnStr("Normal_OK") End If End Sub Public Sub Main() Dim uc As New uCalc() uc.Error.AddHandler(AddressOf RecoveryHandler) uc.DefineFunction("DoWork(s As String) As String", AddressOf RiskyOperation) Console.WriteLine("Result: " + uc.EvalStr("DoWork('good')")) Console.WriteLine("---") Console.WriteLine("Result: " + uc.EvalStr("DoWork('bad')")) End Sub End Module
ID: 479
using uCalcSoftware;
var uc = new uCalc();
static void DoublePositive(uCalc.Callback cb) {
// If input is negative, raise a syntax error.
if (cb.Arg(1) < 0) {
cb.Error.Raise(ErrorCode.Syntax_Error);
}
cb.Return(cb.Arg(1) * 2);
}
uc.DefineFunction("DoublePositive(x)", DoublePositive);
Console.WriteLine(uc.EvalStr("DoublePositive(10)"));
Console.WriteLine(uc.EvalStr("DoublePositive(-5)"));
20
Syntax error using uCalcSoftware; var uc = new uCalc(); static void DoublePositive(uCalc.Callback cb) { // If input is negative, raise a syntax error. if (cb.Arg(1) < 0) { cb.Error.Raise(ErrorCode.Syntax_Error); } cb.Return(cb.Arg(1) * 2); } uc.DefineFunction("DoublePositive(x)", DoublePositive); Console.WriteLine(uc.EvalStr("DoublePositive(10)")); Console.WriteLine(uc.EvalStr("DoublePositive(-5)"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
void ucalc_call DoublePositive(uCalcBase::Callback cb) {
// If input is negative, raise a syntax error.
if (cb.Arg(1) < 0) {
cb.Error().Raise(ErrorCode::Syntax_Error);
}
cb.Return(cb.Arg(1) * 2);
}
int main() {
uCalc uc;
uc.DefineFunction("DoublePositive(x)", DoublePositive);
cout << uc.EvalStr("DoublePositive(10)") << endl;
cout << uc.EvalStr("DoublePositive(-5)") << endl;
}
20
Syntax error #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call DoublePositive(uCalcBase::Callback cb) { // If input is negative, raise a syntax error. if (cb.Arg(1) < 0) { cb.Error().Raise(ErrorCode::Syntax_Error); } cb.Return(cb.Arg(1) * 2); } int main() { uCalc uc; uc.DefineFunction("DoublePositive(x)", DoublePositive); cout << uc.EvalStr("DoublePositive(10)") << endl; cout << uc.EvalStr("DoublePositive(-5)") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub DoublePositive(ByVal cb As uCalc.Callback)
'// If input is negative, raise a syntax error.
If cb.Arg(1) < 0 Then
cb.Error.Raise(ErrorCode.Syntax_Error)
End If
cb.Return(cb.Arg(1) * 2)
End Sub
Public Sub Main()
Dim uc As New uCalc()
uc.DefineFunction("DoublePositive(x)", AddressOf DoublePositive)
Console.WriteLine(uc.EvalStr("DoublePositive(10)"))
Console.WriteLine(uc.EvalStr("DoublePositive(-5)"))
End Sub
End Module
20
Syntax error Imports System Imports uCalcSoftware Public Module Program Public Sub DoublePositive(ByVal cb As uCalc.Callback) '// If input is negative, raise a syntax error. If cb.Arg(1) < 0 Then cb.Error.Raise(ErrorCode.Syntax_Error) End If cb.Return(cb.Arg(1) * 2) End Sub Public Sub Main() Dim uc As New uCalc() uc.DefineFunction("DoublePositive(x)", AddressOf DoublePositive) Console.WriteLine(uc.EvalStr("DoublePositive(10)")) Console.WriteLine(uc.EvalStr("DoublePositive(-5)")) End Sub End Module
ID: 37
using uCalcSoftware;
var uc = new uCalc();
static void RaiseErrorCallback(uCalc.Callback cb) {
if (cb.Arg(1) == 123) {
cb.Error.Raise(ErrorCode.Unrecognized_Command);
}
cb.Return(cb.Arg(1));
}
uc.DefineFunction("ErrRaiseTest(Value)", RaiseErrorCallback);
Console.WriteLine(uc.EvalStr("ErrRaiseTest(111)"));
Console.WriteLine(uc.EvalStr("ErrRaiseTest(123)")); // The callback arbitrarily raises an error for 123
111
Unrecognized command using uCalcSoftware; var uc = new uCalc(); static void RaiseErrorCallback(uCalc.Callback cb) { if (cb.Arg(1) == 123) { cb.Error.Raise(ErrorCode.Unrecognized_Command); } cb.Return(cb.Arg(1)); } uc.DefineFunction("ErrRaiseTest(Value)", RaiseErrorCallback); Console.WriteLine(uc.EvalStr("ErrRaiseTest(111)")); Console.WriteLine(uc.EvalStr("ErrRaiseTest(123)")); // The callback arbitrarily raises an error for 123
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
void ucalc_call RaiseErrorCallback(uCalcBase::Callback cb) {
if (cb.Arg(1) == 123) {
cb.Error().Raise(ErrorCode::Unrecognized_Command);
}
cb.Return(cb.Arg(1));
}
int main() {
uCalc uc;
uc.DefineFunction("ErrRaiseTest(Value)", RaiseErrorCallback);
cout << uc.EvalStr("ErrRaiseTest(111)") << endl;
cout << uc.EvalStr("ErrRaiseTest(123)") << endl; // The callback arbitrarily raises an error for 123
}
111
Unrecognized command #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call RaiseErrorCallback(uCalcBase::Callback cb) { if (cb.Arg(1) == 123) { cb.Error().Raise(ErrorCode::Unrecognized_Command); } cb.Return(cb.Arg(1)); } int main() { uCalc uc; uc.DefineFunction("ErrRaiseTest(Value)", RaiseErrorCallback); cout << uc.EvalStr("ErrRaiseTest(111)") << endl; cout << uc.EvalStr("ErrRaiseTest(123)") << endl; // The callback arbitrarily raises an error for 123 }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub RaiseErrorCallback(ByVal cb As uCalc.Callback)
If cb.Arg(1) = 123 Then
cb.Error.Raise(ErrorCode.Unrecognized_Command)
End If
cb.Return(cb.Arg(1))
End Sub
Public Sub Main()
Dim uc As New uCalc()
uc.DefineFunction("ErrRaiseTest(Value)", AddressOf RaiseErrorCallback)
Console.WriteLine(uc.EvalStr("ErrRaiseTest(111)"))
Console.WriteLine(uc.EvalStr("ErrRaiseTest(123)")) '// The callback arbitrarily raises an error for 123
End Sub
End Module
111
Unrecognized command Imports System Imports uCalcSoftware Public Module Program Public Sub RaiseErrorCallback(ByVal cb As uCalc.Callback) If cb.Arg(1) = 123 Then cb.Error.Raise(ErrorCode.Unrecognized_Command) End If cb.Return(cb.Arg(1)) End Sub Public Sub Main() Dim uc As New uCalc() uc.DefineFunction("ErrRaiseTest(Value)", AddressOf RaiseErrorCallback) Console.WriteLine(uc.EvalStr("ErrRaiseTest(111)")) Console.WriteLine(uc.EvalStr("ErrRaiseTest(123)")) '// The callback arbitrarily raises an error for 123 End Sub End Module