Hey men, can you really catch and ignore a JError::raiseError? I personally use JDatabase and when a person functions 'stupid' a replica entry can happen. But that is no problem and may be overlooked quietly.

Unfortunatelly this error is printed within the hole page. Now i shouldn't drop a brand new query just to see if this primary key already is available.

There's NO Avoid raiseError

Below is Joomla's raise method. As you can tell it uses jexit which calls php exit

function & raise($level, $code, $msg, $info = null, $backtrace = false)
{
    jimport('joomla.error.exception');

    // build error object
    $exception = new JException($msg, $code, $level, $info, $backtrace);

    // see what to do with this kind of error
    $handler = JError::getErrorHandling($level);

    $function = 'handle'.ucfirst($handler['mode']);
    if (is_callable(array('JError', $function))) {
        $reference =& JError::$function ($exception, (isset($handler['options'])) ? $handler['options'] : array());
    } else {
        // This is required to prevent a very unhelpful white-screen-of-death
        jexit(
            'JError::raise -> Static method JError::' . $function . ' does not exist.' .
            ' Contact a developer to debug' .
            '<br /><strong>Error was</strong> ' .
            '<br />' . $exception->getMessage()
        );
    }

    //store and return the error
    $GLOBALS['_JERROR_STACK'][] =& $reference;
    return $reference;
}

if overwriting the present row does not matter you could utilize

REPLACE INTO 'table' set 'field'=1 etc etc

MYSQL REPLACE

Developing a row or replace a current one. Which should allow it to be so no error is elevated whatsoever when the row is available.

To disable tossing of Joomla exceptions within the execution path call:

JError::setErrorHandling(E_ALL, "ignore");

Alternative you are able to set your personal custom handler:

JError::setErrorHandling(E_ALL, 'callback', array('myClass', 'myErrorHandlerFunction'))