@rootPathFromName
interface API
{
@path("mytrack") @method(HTTPMethod.GET) Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime);
}

class MyRouter : API
{
   Config config;
   Database database;
   this(Config config, Database database)
   {
    this.config = config;
    this.database = database;
   }

        @path("/")
void foo(string _error = null) // I expect that this will be called if exception happen in doTrackSpeedAnalyze
        {
writeln("Error in console"); // does not writing on console
        }
     override:
        @errorDisplay!foo
Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime) // /api/mytrack?trackid=123&startDateTime=2000&endDateTime=2010
        {
            if(endDateTime == "0")
            {
                throw new Exception("Some fields are empty");
            }
            return Json.emptyObject;
        }

}


What I am doing wrong? Should I do override for foo? Should foo present in `interface`?

Reply via email to