Detecting exceeding max messaging rates

Hello,

Approaching (error 0) or exceeding (error 100) the API messaging rate errors generates an OID=-1. Such arrors show in the ibc messaging window but I have trouble detecting them in my code. I tried this:

OID = ibc.ModifyOrder( OID, Ticker, Action, Qty, Type, LmtPrice, StopPrice, TIF, Transmit, SizeTick, Attr, ParentOID );
if( OID == "-1" ) Trace( "~, " + Now( 2 ) + ", "+Ticker+", OID, "+OID+", Place Order Error: max IB-Messaging Rate exceeded" );

However these errors never show in my DBV window.

Anyone know why?
Happy coding,
Herman

As documented in http://www.amibroker.com/at/ you can get last error for given order using ib.GetLastError() method.

GetLastError( string OrderId )

(new in 1.0.2)

This function returns the text of last error message

Return value:

string representing the error message. Empty in case when there was no error message or there is no such order

Parameters:

OrderId - specifies the order id to query last error information from. There is a special value that you can pass: 0 (zero) and it has a special meaning: it retrieves last error message for ANY order. This is exactly this message that appears on the top of the error list in IBController user interface.