Type/to search
Getting Started
Welcome to FMZ Quant Trading Platform
Quick Start
Key Security
Platform Basics
Account and Billing
Live Robot Billing and Top-up
Sub-accounts
Exchange
General Protocol
Local Credential Files
Exchange-Specific Notes
Securities and Futures
Crypto
Docker
Strategy Library
Live Trading
Writing Strategies
Development Tools
Backtesting System
Advanced Topics
Data and Research
Integrations

onerror(msg) is supported only by JavaScript (including TypeScript) strategies. It is called when main() ends with an uncaught exception; the argument msg is the error message. When onerror() is called, onexit() is not. It may run for at most 5 minutes and is terminated when it exceeds that. The backtesting system does not support this function.

Python and Rust strategies do not support onerror().

Examples

javascript
function main() { var arr = [] Log(arr[6].Close) // deliberately raise an exception here } function onerror(msg) { Log("Error:", msg) }
python
# Not supported in Python
rust
// Not supported in Rust