“Oops, an error occurred!” is not a valid error message

Written by Johannes on June 19, 2012 Categories: extbase, fluid, TYPO3, Webdevelopment

Your ads will be inserted here by

Easy AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

I just spent an hour trying to debug my implementation of a Fluid ViewHelper. Using tag-based notation: <namespace:viewhelper arg="val" /> resulted in no rendering of the ViewHelper. Using the more convenient inline-style notation {namespace:viewhelper(arg: “val)} threw the completely non-descript error message: “Oops, an error occurred!”

The answer to the problem: I registered the namespace in the wrong fashion. Instead of writing {namespace mf=Tx_UserMailform_ViewHelpers} I wrote {namespace mf="Tx_UserMailform_ViewHelpers"}.

This is something I would expect a smart templating language to recognize and throw at least a warning…

UPDATE: Read the comment below by Steffen: make sure to have a BE-session running and you’ll get more informative error messages. My rant was somewhat over the top. The syntax error I made actually throws the error message: “Namespace could not be resolved. This exception should never be thrown!” This gives at least a pointer towards the right direction, even though it probably would still have taken me a while to catch the quotes.

One more thing: make sure to register namespaces in partials, too. Apparently it is not enough to register them in the root template.

6 Comments

6 Comments

  • Steffen Gebert says:

    It is a valid error message for everyone but you. The visitors of your web site shouldn’t know that your MySQL is down or that you screwed up whatever extension, shouldn’t they?

    You can have a look at the PHP error log, to read the full error message. Also, once you have a valid BE login, the full message is shown to you.

    • Johannes says:

      Nice one, you keep on disarming my TYPO3-rants :).

      Looks like my BE-session expired on me, that’s why the error message was non-descript. Is there a flag to force full error messages for development mode?

      • Steffen Gebert says:

        Yes, if you’re within $TYPO3_CONF_VARS['SYS']['devIPmask'], then the t3lib_error_DebugExceptionHandler is used, which will output a full stack trace.

        Maybe ask in mailing lists first before complaining ;-)

        Yours
        Steffen

        • Johannes says:

          I will improve my TYPO3 community social skills :). But there is also a reason this site is called twentysomething _rants_ ;).

  • Bastian says:

    FYI: exceptions are a weak point in Fluid still. We’re working on a better debug mode that outputs the part of your Fluid template that contains the error, but it’s not so easy due to the compiled templates. Stay tuned.

    • Johannes says:

      Good to hear. I’m used to working with Django templating/twig so I’m somewhat spoiled but I appreciate the effort that goes into extbase/fluid. It’s a huge step up from pibase, despite the occasional quirks and gotchas.

      Hopefully I’ll be able to give more constructive feedback once I get more comfortable with extbase/fluid.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre user="" computer="" escaped="">