function reportError()
    {
        // If we have a running transaction we must mark as invalid
        // in which case a call to commit() will perform a rollback
        if ( $this->TransactionCounter > 0 )
        {
            $this->invalidateTransaction();

            // This is the unique ID for this incidence which will also be placed in the error logs.
            $transID = 'TRANSID-' . md5( time() . mt_rand() );

            eZDebug::writeError( 'Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is ' . $transID . '.', 'eZDBInterface::commit ' . $transID );

            $this->rollback();

            if ( $this->errorHandling == eZDB::ERROR_HANDLING_EXCEPTIONS )
            {
                throw new eZDBException( $this->ErrorMessage, $this->ErrorNumber );
            }
            else
            {
                // Stop execution immediately while allowing other systems (session etc.) to cleanup
                eZExecution::cleanup();
                eZExecution::setCleanExit();

                // Give some feedback, and also possibly show the debug output
                eZDebug::setHandleType( eZDebug::HANDLE_NONE );

                $ini = eZINI::instance();
                $adminEmail = $ini->variable( 'MailSettings', 'AdminEmail' );
                if ( !eZSys::isShellExecution() )
                {
                    if ( !headers_sent() )
                    {
                        header("HTTP/1.1 500 Internal Server Error");
                    }
                    $site = htmlentities(eZSys::serverVariable( 'HTTP_HOST' ), ENT_QUOTES);
                    $uri = htmlentities(eZSys::serverVariable( 'REQUEST_URI' ), ENT_QUOTES);

                    print( "<div class=\"fatal-error\" style=\"" );
                    print( 'margin: 0.5em 0 1em 0; ' .
                           'padding: 0.25em 1em 0.75em 1em;' .
                           'border: 4px solid #000000;' .
                           'background-color: #f8f8f4;' .
                           'border-color: #f95038;" >' );
                    print( "<b>Fatal error</b>: A database transaction in eZ Publish failed.<br/>" );
                    print( "<p>" );
                    print( "The current execution was stopped to prevent further problems.<br/>\n" .
                           "You should contact the <a href=\"mailto:$adminEmail?subject=Transaction failed on $site and URI $uri with ID $transID\">System Administrator</a> of this site with the information on this page.<br/>\n" .
                           "The current transaction ID is <b>$transID</b> and has been logged.<br/>\n" .
                           "Please include the transaction ID and the current URL when contacting the system administrator.<br/>\n" );
                    print( "</p>" );
                    print( "</div>" );

                    $templateResult = null;
                    if ( function_exists( 'eZDisplayResult' ) )
                    {
                        eZDisplayResult( $templateResult );
                    }
                }
                else
                {
                    fputs( STDERR,"Fatal error: A database transaction in eZ Publish failed.\n" );
                    fputs( STDERR, "\n" );
                    fputs( STDERR, "The current execution was stopped to prevent further problems.\n" .
                           "You should contact the System Administrator ($adminEmail) of this site.\n" .
                           "The current transaction ID is $transID and has been logged.\n" .
                           "Please include the transaction ID and the name of the current script when contacting the system administrator.\n" );
                    fputs( STDERR, "\n" );

                    fputs( STDERR, eZDebug::printReport( false, false, true ) );
                }

                // PHP execution stops here
                exit( 1 );
            }
        }
    }