Type/to search
Built-in Functions
Global
Version
IsVirtual
GetOS
GetPid
GetMeta
Sleep
Unix
UnixNano
_D
GetCommand
GetLastError
SetErrorFilter
_N
_C
_Cross
JSON.parse
JSON.stringify
Encode
MD5
UUID
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
TA
Talib
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Retrieves the most recent error message.

GetLastError()

Examples

Query a nonexistent order, then read the error message.

javascript
function main(){ // Since order number 123 does not exist, this will trigger an error exchange.GetOrder("123") var error = GetLastError() Log(error) // Output: the error message of the failed GetOrder call }
python
def main(): exchange.GetOrder("123") error = GetLastError() Log(error) # Output: the error message of the failed GetOrder call
rust
fn main() { // Since order number 123 does not exist, this will trigger an error // Rust's GetOrder accepts a &OrderId parameter; the string id must be placed in the S field let id = OrderId { S: "123".to_string(), ..Default::default() }; let _ = exchange.GetOrder(&id); let error = GetLastError(); Log!(error); // Output: the error message of the failed GetOrder call }

Returns

TypeDescription

string

The most recent error message.

See Also

Remarks

This function does not work in the backtesting system.