madebyraygun / craft-component-library

Craft CMS Plugin for Component Library
MIT License
4 stars 0 forks source link

Internal error when no preview.twig file is present #24

Closed daltonrooney closed 2 months ago

daltonrooney commented 3 months ago
2024-07-29 11:33:21 [web.ERROR] [craft\web\twig\TemplateLoaderException] Unable to resolve template "@preview" at {template}. {"trace":["#0 /var/www/html/vendor/madebyraygun/component-library/src/web/twig/TemplateLoader.php(72): madebyraygun\\componentlibrary\\web\\twig\\TemplateLoader->_resolveTemplate('@preview')","#1 /var/www/html/vendor/twig/twig/src/Environment.php(264): madebyraygun\\componentlibrary\\web\\twig\\TemplateLoader->getCacheKey('@preview')","#2 /var/www/html/vendor/twig/twig/src/Environment.php(312): Twig\\Environment->getTemplateClass('@preview')","#3 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\\Environment->load('@preview')","#4 /var/www/html/vendor/craftcms/cms/src/web/View.php(488): Twig\\Environment->render('@preview', Array)","#5 /var/www/html/vendor/craftcms/cms/src/web/View.php(541): craft\\web\\View->renderTemplate('@preview', Array)","#6 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\\web\\View->renderPageTemplate('@preview', Array, 'site')","#7 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1109): craft\\web\\TemplateResponseFormatter->format(Object(craft\\web\\Response))","#8 /var/www/html/vendor/craftcms/cms/src/web/Response.php(338): yii\\web\\Response->prepare()","#9 /var/www/html/vendor/yiisoft/yii2/web/Response.php(340): craft\\web\\Response->prepare()","#10 /var/www/html/vendor/yiisoft/yii2/base/Application.php(390): yii\\web\\Response->send()","#11 /var/www/html/public/index.php(12): yii\\base\\Application->run()","#12 {main}"],"memory":4403000,"exception":"[object] (craft\\web\\twig\\TemplateLoaderException(code: 0): Unable to resolve template \"@preview\" at {template}. at /var/www/html/vendor/madebyraygun/component-library/src/web/twig/TemplateLoader.php:108)"}

Maybe we can include a default preview template with the plugin if the user preview template isn't found that includes a message on how to add a preview template to your library.