GetLastError
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
| Type | Description |
string | The most recent error message. |
See Also
Remarks
This function does not work in the backtesting system.