incorrect API documention for error codes

Created at 21 Jan 2020, 10:33
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
snowchilli's avatar

snowchilli

Joined 28.06.2016

incorrect API documention for error codes
21 Jan 2020, 10:33


Both cTrader Automate 3.6 and https://ctrader.com/api/reference/errorcode give an example that the "build" command of cTrader Automate 3.6 rejects with an error.

The example:

protected override void OnError(Error error)
{
    //  Print the error to the log
    switch (error.Code)
    {
            case ErrorCode.BadVolume: Print("Bad Volume");
            break;
            case ErrorCode.TechnicalError:Print("Technical Error");
            break;
            case ErrorCode.NoMoney: Print("No Money");
            break;
            case ErrorCode.Disconnected: Print("Disconnected");
            break;
            case ErrorCode.MarketClosed: Print("Market Closed");
            break;
    }
}

gives this error: 
Error CS0115: 'cAlgo.Robots.ScalperBot.OnStop(cAlgo.API.ErrorCode)': no suitable method found to override

The cursor sits immediately in front of the OnError token:  protected override void |OnError(Error error)


@snowchilli
Replies

PanagiotisCharalampous
21 Jan 2020, 10:40

Hi snowchilli,

Based on the error code, you are using a wrong method name

Error CS0115: 'cAlgo.Robots.ScalperBot.OnStop(cAlgo.API.ErrorCode)': no suitable method found to override

You have pasted the OnError() method code but it seems your actual method is called OnStop(). If you paste your complete cBot code, we can check and fix this for you.

 Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

snowchilli
21 Jan 2020, 11:10

RE:

Apologies - I had pasted the code into an OnStop function instead of an OnError function.
Thank you for your swift reply.


@snowchilli