Errors
To report an error, an action throws an exception that implements
\TYPO3\CMS\Core\Action\ActionExceptionInterface. The exception sets the
HTTP status code of the response. These errors are available:
\TYPO3\CMS\Core\Action\ActionException, the base class400\TYPO3\CMS\Core\Action\Error\NotFoundError404\TYPO3\CMS\Core\Action\Error\PermissionDeniedError403\TYPO3\CMS\Core\Action\Error\InsufficientScopeError, with
the header WWW-Authenticate that names the missing scope403\TYPO3\CMS\Core\Action\Error\ConflictError409\TYPO3\CMS\Core\Action\Error\InvalidRequestError, with an optional
list of the invalid values400| Exception | Status |
|---|---|
\TYPO3\CMS\Core\Action\ActionException, the base class | 400 |
\TYPO3\CMS\Core\Action\Error\NotFoundError | 404 |
\TYPO3\CMS\Core\Action\Error\PermissionDeniedError | 403 |
\TYPO3\CMS\Core\Action\Error\InsufficientScopeError, with
the header WWW-Authenticate that names the missing scope | 403 |
\TYPO3\CMS\Core\Action\Error\ConflictError | 409 |
\TYPO3\CMS\Core\Action\Error\InvalidRequestError, with an optional
list of the invalid values | 400 |
TYPO3 returns the error as problem details (RFC 9457), with the message as
detail. The exception code is part of the API: the problem type is the URL
of the code in the TYPO3 exception reference. An
InvalidArgumentException gets the status 400, with its message as
detail. TYPO3 logs all other exceptions and returns the status 500 without
internal details.
Declare every error of an action with a @throws annotation on the
action method. TYPO3 reads these annotations when it compiles the dependency
injection container. The OpenAPI document shows a response for each error.