-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message from TemplateNotFoundException is "lost" #397
Comments
Hi @nilshartmann, thank you for reporting! When using jte directly, this should already be the case, since the I assume you are using the spring boot plugin? The
Reading the contract, this method seems to behave as expected (does not throw if resource does not exist). We could add something like this to jte: public void checkTemplateExists(String name) throws TemplateNotFoundException {
resolveTemplate(name);
} And then catch and log the exception in @atomfrede, @tschuehly do you know if there is a way to log messages in the spring boot plugin? |
@casid Yes, you're right, I'm using the Spring Boot starter (for some reason I removed this info from my description 🤦♂️) I think the method behaves correctly but it would be nice to somehow see the original error message. |
Good point. Let me check how others starters behave, but totally agree at least see the message would be helpful, on particular for typos |
When the TemplateEngine tries to load a template that cannot be found, the origin TemplateNotFoundException is not logged anywhere. That's a little sad, because the message contains the actual path, the engine tried to load the template from, and that information is very helpful when trying to investigate, why the template could not be loaded.
In
gg.jte.TemplateEngine#resolveTemplateOnDemand
it is caught, then re-thrown and in finally caught ingg.jte.TemplateEngine#hasTemplate
, where the caugt exception is interpreted asfalse
(template does not exists).I wonder, if somewhere in between this very helpful message could be logged to simplify bug fixing.
The text was updated successfully, but these errors were encountered: