public function errorhandler($exception) {
		$errstr		= $exception->getMessage();
		$errcode	= $exception->getCode();
		$backtrace	= $exception->getTrace();
		
		// the same should not be outputted more than once
		if ($errstr == $this->lasterror) return;
		$this->lasterror = $errstr;

		// count errors to produce unique ids
		$this->errorcounter++;

		// if it is an error throw away the first backtrace item
		if ($exception instanceof ErrorException) array_shift($backtrace);
		
		// add actual error to backtrace
		$bt['file'] = $exception->getFile();
		$bt['line'] = $exception->getLine();
		array_unshift($backtrace, $bt);
		
		// clean array
		$backtrace_keys = ['file'=>'', 'line'=>'', 'class'=>'', 'object'=>'', 'type'=>'', 'function'=>'', 'args'=>[]];
		foreach ($backtrace as $key => $value) {
			$backtrace[$key] = array_merge($backtrace_keys, $value);
		}
		
		// set the error code string
		if ($exception instanceof ErrorException) $errordescription = $this->errortypes[ $exception->getSeverity() ];
		elseif ($errcode == 0) $errordescription = 'EXCEPTION';
		else $errordescription = 'EXCEPTION (Code '.$errcode.')';

		// show error on screen
		if (!is_int($this->config['output']['screen'])) {
			die(__CLASS__ . ': debug.output.screen has to a valid PHP timestamp.');
		}

		if (time() < $this->config['output']['screen']) {
			$error = $this->_errorhandler_output($errstr, $backtrace, $errordescription);
			echo $error;
		}

		// log error in logfile
		if (!is_int($this->config['output']['file'])) {
			die(__CLASS__ . ': debug.output.file has to a valid PHP timestamp.');
		}

		if (time() < $this->config['output']['file']) {
			$this->_errorhandler_file($errstr, $backtrace, $errordescription);
		}

		// trigger event/hook
		if ($this->_event_object !== null) {
			$this->_event_object->trigger('core.after_exception', $exception);
		}
	}