Task #80381
closed
Show template/partial name when an exception occurs with Fluid
Added by Xavier Perseguers over 7 years ago.
Updated over 6 years ago.
Description
I have following exception in frontend while upgrading a website initially done for TYPO3 v6 to v8:
Oops, an error occurred!
Undeclared arguments passed to ViewHelper FluidTYPO3\Vhs\ViewHelpers\IfViewHelper: then, else
Exception is thrown from \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper::validateAdditionalArguments
.
Here's the StackTrace:
It would be very useful to have additional information with the culprit template/partial file.
In this example this is not the actual name in the filesystem (which would be even better) but at least this parsed file with checksum gives a hint of where to look for the problem.
Files
- Status changed from New to Needs Feedback
Looks like it's an issue with EXT:vhs?
There's indeed a problem related to the use of a VH from vhs but the stack trace shows that it goes a long way into fluid and the exception is thrown from fluid, not from vhs. As such this problem could happen with any extension so the exception thrown ultimately give more info, that is it should probably be catched "higher" and thrown again with more context.
Fluid doesn't at this point know (or care) about the template path and filename. The exception that gets thrown should be a Parser scope exception which should contain additional information about the context (even includes the offending template code) - I guess we could fit this exception with a bit more context.
If you use debug mode you should see these additional aspects of the exception. I'm not sure the default error handler should show these things (I'd say no, it shouldn't)?
NB: I haven't checked recently but a while back this was true: setting application context in Install Tool is insufficient to cause a debug error handler to be used for content instances. For that, you have to set TYPO3_APPLICATION_CONTEXT in ENV/vhost.
- Status changed from Needs Feedback to New
Is the problem resolved Xavier?
- Status changed from New to Closed
I will close this issue since we cannot currently improve this situation in TYPO3 CMS. It might at some point be possible to give additional information with errors - but we would need that as a feature request for https://github.com/TYPO3/Fluid. The main challenge is that Fluid's parser only handles template sources and knows about the identifier - the actual filename only exists in a closure that gets passed to the template parser which then calls it to read the template source.
If this can be done, I suspect it might have to be through a coupling of TemplateParser and TemplatePaths - which may not be a good thing.
Also available in: Atom
PDF