req
が短すぎるとエラーメッセージを表示しようとしています。ここでは、コードは次のようになります。エラー:テンプレートインスタンスのインスタンス化エラー
import std.stdio;
import vibe.d;
Database mydatabase;
void main()
{
// ...
router.get("*", &myStuff); // all other request
listenHTTP(settings, router);
runApplication();
}
@errorDisplay!showPageNotFound
void myStuff(HTTPServerRequest req, HTTPServerResponse res) // I need this to handle any accessed URLs
{
if(req.path.length > 10)
{
// ...
}
else
{
throw new Exception("Nothing do not found");
}
}
void showPageNotFound(string _error = null)
{
render!("error.dt", _error);
}
エラーは次のとおりです。
source\app.d(80,2): Error: template instance app.showPageNotFound.render!("error.dt", _error).render!("app", "app.showPageNotFound") error instantiating
私がやっている場合:あなたが見れば Error: undefined identifier 'res'