Skip to content

GSPy_v1.8.8

Choose a tag to compare

@jasonGtg jasonGtg released this 19 Nov 01:15
· 8 commits to main since this release

What's New
GSPy v1.8.8 introduces fatal error signaling, giving Python scripts the ability to stop GoldSim simulations when critical errors occur.

New Feature: gspy.error()
Python scripts can now signal fatal errors that immediately terminate simulations:

import gspy
import traceback

def process_data(*args):
try:
result = calculate(args)
return (result,)
except Exception as e:
gspy.log(traceback.format_exc(), 0) # Log details
gspy.error(f"Critical error: {e}") # Stop simulation
return (0.0,)
When to use: Division by zero, missing required files, invalid configuration, or any error that makes results unreliable.

What happens: Simulation stops immediately, GoldSim displays "Error in external function. Return code 1.", and detailed error information is written to the log file.

Why Error Messages Go to Log Files
Due to the 32-bit GoldSim / 64-bit DLL architecture, the processes run in separate memory spaces and cannot share pointers. Error messages are written to log files (the authoritative debugging source) rather than displayed in GoldSim dialogs.

Additional Improvements
Enhanced exception handling throughout the C++ codebase
Better error detection and reporting in PythonManager
Fixed time series duration bug in mixed_types.py example
Comprehensive error handling documentation in README.md
Backward Compatibility
Fully backward compatible - Existing code continues to work unchanged. The gspy.error() function is optional and only needed when you want to stop simulations on critical errors.

Two Error Handling Approaches
Graceful Degradation - Use gspy.log() only for recoverable errors (simulation continues with safe fallback values)
Fatal Error Signaling - Use gspy.error() for critical errors (simulation stops immediately)
Download: https://github.com/GoldSim/gspy
Documentation: See README.md for complete error handling guide
Example: examples/Error Handling Demo/ demonstrates both approaches