Oops, an error occurred! - Komplette Fehlermeldung anzeigen.

19 July 2017
TypoScript

Oops, I can't do anything with the error... but what to do?
Don't panic - it's not that bad! There is a simple way to get rid of the error message like: "Oops, an error occurred! Code: 2017042520255025e4885c".

With TYPO3 9.5.x the procedure is still the same, also in 10.x or 11.x.

TLDR; directly to the contentObjectExceptionHandler.

One way is to open the log file and look for the error code in it. This will look something like this:

You can find the file under:

 

# Older TYPO3 systems
typo3temp/logs/typo3_[abc123].log

# Newer TYPO3 systems
typo3temp/var/logs/typo3_[abc123].log

# current systems installed with Composer:
var/log/typo3_[abc123].log

 

Here we can read out what it is about, but this method is not very comfortable.

Anpassung am TypoScript

The better choice is to set a setting in the TypoScript to output the error message visually in the frontend/backend. For this, you only have to make a small setting in the TypoScript.

If you want to activate the output for all subpages, you make the setting on your main template, which is usually on the root page (red frame). Alternatively, you can also set this for subpages by creating an extension template.

So edit your TypoScript template. To do this, select the template module in the sidebar, switch to "Info/Modify" and enter the following setting in the setup:

 

config.contentObjectExceptionHandler = 0

If you now call the page with the error again, you should get a more or less speaking error message.
In my case I wrote the call of a ViewHelper in the template wrong on purpose to provoke this error (screenshot from TYPO3 8.7.1):

"TYPO3Fluid\Fluid\ViewHelpers\ImadgeViewHelper", however this class does not exist.

 

Die Fehlermeldung ist sprechend und gibt uns in diesem Fall einen ziemlich eindeutigen Hinweis, wo das Problem liegt.
 

Even if your error message fills the entire page and looks like this screenshot, there is usually an error message at the top that can be easily interpreted. Below is then a program flow (stacktrace) to possibly understand the problem better.

In TYPO3 9.5.x the design is more modern and the stacktrace is a bit clearer, but for the eye of a normal user still very complicated to look at. For the sake of completeness, here is also a screenshot of how it looks in current versions.

Last but not least a little tip:

If you set the ExceptionHandler to 1 (or remove the setting completely) you activate the default setting and the frontend will display "Oops, an error occurred!" again.

By the way, you can customize this text with another TypoScript setting:

 

config.contentObjectExceptionHandler = 1
config.contentObjectExceptionHandler.errorMessage = Oje, das hat nicht geklappt! %s

 

This way you can prevent the website visitor from getting an error page/message that will upset him, and at the same time you can customize the text to match your page - assuming it will ever actually be output - which of course we hope it won't be ;)

Good luck with debugging

Thomas Anders

XS SM MD LG XL XXL