Exemple #1
0
 static function run($app)
 {
     sinatra_Base::$request = new sinatra_Request();
     haxe_Log::trace(sinatra_Base::$request, _hx_anonymous(array("fileName" => "Base.hx", "lineNumber" => 56, "className" => "sinatra.Base", "methodName" => "run")));
     $route = null;
     $»it = sinatra_Base::$_routes->get(sinatra_Base::$request->method)->iterator();
     while ($»it->hasNext()) {
         $r = $»it->next();
         if (sinatra_Route::match($r->route, sinatra_Base::$request->path)) {
             $route = $r;
             break;
         }
     }
     if ($route === null) {
         throw new HException("Found no route matching \"" . sinatra_Base::$request->path . "\"");
     }
     $view = null;
     try {
         $view = $route->call();
     } catch (Exception $»e) {
         $_ex_ = $»e instanceof HException ? $»e->e : $»e;
         if (is_int($code = $_ex_)) {
             haxe_Log::trace("CODE:" . Std::string($code), _hx_anonymous(array("fileName" => "Base.hx", "lineNumber" => 76, "className" => "sinatra.Base", "methodName" => "run")));
         } else {
             if (is_string($err = $_ex_)) {
                 haxe_Log::trace("ERR:" . $err . " stack: " . haxe_Stack::toString(haxe_Stack::exceptionStack()), _hx_anonymous(array("fileName" => "Base.hx", "lineNumber" => 78, "className" => "sinatra.Base", "methodName" => "run")));
             } else {
                 $other = $_ex_;
                 haxe_Log::trace("WARN:" . Std::string($other), _hx_anonymous(array("fileName" => "Base.hx", "lineNumber" => 80, "className" => "sinatra.Base", "methodName" => "run")));
             }
         }
     }
     if ($view !== null) {
         $view->render();
     }
     return 0;
 }
 static function main()
 {
     sinatra_Base::run(new Application());
 }