Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Error codes and module results

The kernel error codes a view returns with handleError() - access denied, not found, not available, moved, form token refused - their HTTP status in error.ini and the error templates.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-8-reference/error-codes-and-module-results.md

On this page

Error codes and module results

Part 8, reference 29. A view that cannot do its job returns an error instead of a result: return $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );. The kernel then shows the error page for that code, with the right HTTP status, and (for access denied) may ask the visitor to sign in. This page lists the codes and how they are handled.

The kernel codes (eZError, kernel/classes/ezerror.php)

ConstantCodeUse it whenHTTP status (error.ini)
KERNEL_ACCESS_DENIED1the user may not do this401; the default settings show the sign-in view in its place (ErrorHandler[1]=embed, EmbedURL[1]=/user/login)
KERNEL_NOT_FOUND2the thing asked for does not exist404
KERNEL_NOT_AVAILABLE3it exists but cannot be shown now (wrong ID, missing parameter, unpublished)404
KERNEL_MOVED4it moved301
KERNEL_LANGUAGE_NOT_FOUND5the requested translation does not exist
KERNEL_FORM_TOKEN_REFUSED6a POST without a valid form token (the kernel uses it)403
KERNEL_MODULE_NOT_FOUND20no such module404
KERNEL_MODULE_VIEW_NOT_FOUND21no such view404
KERNEL_MODULE_DISABLED22the module is switched off404
KERNEL_NO_DB_CONNECTION50the database is unreachable

There are also shop codes (SHOP_*) for the shop module's own errors.

In a view

<?php
$Module = $Params['Module'];
$itemID = (int)$Params['ItemID'];
$item = myExtItem::fetch( $itemID );
if ( !$item instanceof myExtItem )
{
    return $Module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );
}
$access = eZUser::currentUser()->hasAccessTo( 'myext', 'manage' );
if ( $access['accessWord'] !== 'yes' )
{
    return $Module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );
}

Return the call: the view must end there.

How the kernel handles each code

settings/error.ini [ErrorSettings-kernel] decides per code:

SettingMeaning
ErrorHandler[<code>]displayerror (show the error template, the default), redirect, rerun or embed (show another view, like the sign-in)
RedirectURL[<code>], EmbedURL[<code>]where to
HTTPError[<code>]the HTTP status sent

The error pages are the templates error/kernel/<code>.tpl in the design chain; a theme can override them.

Errors that are not views

  • JSON answers (an Ajax view): set the HTTP status yourself and answer with a JSON body; do not return an HTML error page to a script.
  • Command line scripts: write the error with $cli->error() and end with a non-zero exit code (eZScript and eZCLI).
  • Fatal PHP errors end in the kernel's general error page; the details go to the log, never to the visitor.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x