0
votes

I'm currently programming a scheduler task to run in my typo3 backend. For more security and a better debuggable workflow I want to throw exceptions that get displayed in the "scheduled tasks" section when running a task as well as display a red box rather than a green box because the task has failed. Unfortunately I cant get it work. Returning an exception ends in a printed exception-string with a green/success infobox. When just throw the exception by throw new Exception ends in a red/error infobox with no hint what the exception message was.

public function importCommand($filetype) {

    try {

        if(!$this->isValidFileTypeConfigured($filetype)) {
            throw new \TYPO3\MbxRealestate\Helper\Exception\ImportImmoException('Unsupported filetype "' . $filetype . '" configured in ' . __CLASS__ . '::' . __FUNCTION__);
        }

       ....

    } catch (\Exception $ex) {

        throw $ex; // throwing ...
        return $ex; // or returning 
    }

    return true;
}
1

1 Answers

0
votes

You can use the Flash Message API in TYPO3 to output your errors. There are 5 types of errors and respective styling. See here:

http://docs.typo3.org/TYPO3/CoreApiReference/ApiOverview/FlashMessages/Index.html