Feature #40857

When template is automatically retrieved but not found, a hint about the tried location should be present

Added by Adrian Föder almost 3 years ago. Updated over 2 years ago.

Status:Resolved Start date:2012-09-12
Priority:Should have Due date:
Assigned To:Adrian Föder % Done:

100%

Category:MVC
Target version:TYPO3 Flow Base Distribution - 2.0 beta 1
PHP Version: Complexity:
Has patch:No

Description

Currently, Fluid throws a nice exception when a template file couldn't be found at a tried location.
FLOW3, however, eats this exception and gives a generic "No template was found. View could not be resolved for action ..."
This should be augmented with the tried path which can give a perfect hint why the file was not found (eg a simple typo or a controller name the developer wasn't aware of).


Related issues

related to TYPO3.Flow - Feature #39423: Custom Error Renderers Resolved 2012-12-25
related to TYPO3.Flow - Bug #40888: Add ViewNotFoundException Resolved 2012-09-13
related to TYPO3.Flow - Feature #42176: Improve resolving of view Resolved 2012-10-19

Associated revisions

Revision 9f99c840
Added by Bastian Waidelich over 2 years ago

[BUGFIX] Throw ViewNotFoundException if view could not be resolved

This improves the resolving of views by removing the canRender()
checks from ActionController::resolveView as discussed in #42176.

Besides this skips the creation of the obsolete NotFoundView in favor
of throwing a ViewNotFoundException.

This also adds overdue unit tests for the ActionController.

Change-Id: I27cba20836d695e46fe355bd1e4168a6fd86eb76
Fixes: #40888
Fixes: #40857
Related: #42176
Releases: 1.2

History

#1 Updated by Adrian Föder almost 3 years ago

  • Tracker changed from Bug to Feature

#2 Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17072

#3 Updated by Karsten Dambekalns over 2 years ago

  • Status changed from Under Review to Resolved
  • Target version set to 2.0 beta 1
  • % Done changed from 0 to 100

#4 Updated by Karsten Dambekalns over 2 years ago

  • Status changed from Resolved to Needs Feedback
  • Target version changed from 2.0 beta 1 to 2.0

Adrian commented on the change:

allow me to ask, why this is annotated to fix #40857? I still can't see which template location(s) were tried in order to determine the view... Still the canRender() method of the action will eat the exception thrown in Fluid.
...and at all, what I just realize: the ->canRender() method is not invoked at all anymore, hence some not found stuff will happen pretty late(r). Is that intentional?
Thanks for clarification :)

#5 Updated by Bastian Waidelich over 2 years ago

Hi Adrian,

I still can't see which template location(s) were tried in order to determine the view...

Really? If I remove/rename a template I now get an exception

#1225709595: Template could not be loaded. I tried "resource://My.Package/Private/Templates/Standard/Index.html" 

Still the canRender() method of the action will eat the exception thrown in Fluid.

ViewInterface::canRender() is not called any longer, as you realized. (and i just realized: we should remove the @api annotation).
The reason is, that this was called very early in the dispatching process preventing the framework to "hook in" (we later need this in order to overwrite template paths from the "outside", see #42176 for details). We also need this now in order to get rid of the "NotFoundView" – otherwise you'd always need a template for an action, even if that returns its content directly

#6 Updated by Adrian Föder over 2 years ago

  • Status changed from Needs Feedback to Resolved

ok, clarified via IRC :) My missing link was, that the patch set in question solved this issue rather as a side effect, hence me didn't see explicitly why that was the case.

#7 Updated by Bastian Waidelich over 2 years ago

  • Target version changed from 2.0 to 2.0 beta 1

Also available in: Atom PDF