Displays the error massage which occurs
@param \Exception $error This should be an instance of Exception
512045
private function error($error) {
        if($this->logErrors) {
            $file = $this->logLocation.'db-errors.txt';
            $current = file_get_contents($file);
            $current .= date('d/m/Y H:i:s')." ERROR: ".$error->getMessage()." on ".$this->sql."\n";
            file_put_contents($file, $current); 
        }
        die($this->displayErrors ? 'ERROR: '.$error->getMessage().' on '.$this->sql : 0);
    }
248700
public function logError($error, $msg = '')
    {
        if (is_object($error)) {
            // we got exception object obviously
            $error = $error->getMessage();
        }
        $this->app->getLogger()->logLine($msg.' '.$error."\n", null, 'error');
    }
784246
public function handleException($exception)
	{
		$response = $this->callCustomHandlers($exception);

		// If one of the custom error handlers returned a response, we will send that
		// response back to the client after preparing it. This allows a specific
		// type of exceptions to handled by a Closure giving great flexibility.
		if ( ! is_null($response))
		{
			$response = $this->prepareResponse($response);
		}

		// If no response was sent by this custom exception handler, we will call the
		// default exception displayer for the current application context and let
		// it show the exception to the user / developer based on the situation.
		else
		{
			$response = $this->displayException($exception);
		}

		return $this->sendResponse($response);
	}
715121
protected function logException(\Exception $exception)
    {
        $this->logger->error(
            $exception->getMessage(),
            array(
                'class'=>get_class($exception),
                'message'=>$exception->getMessage(),
                'file'=>$exception->getMessage(),
                'line'=>$exception->getMessage(),
                'command'=>$this->getName()
            )
        );
    }
183013
private function logException(Exception $exception): void
    {
        if ($exception instanceof HttpExceptionInterface && $exception->getStatusCode() < 500) {
            return;
        }

        $this->logger->critical(
            sprintf(
                'Uncaught PHP Exception %s: "%s" at %s line %s',
                get_class($exception),
                $exception->getMessage(),
                $exception->getFile(),
                $exception->getLine()
            ),
            ['exception' => $exception]
        );
    }
178372
protected function showHTTP($exception) {
		header("HTTP/1.1 400 Unexpected error");
		$message = preg_replace('![^a-z 0-9_-]!','',$this->getMessageForUser($exception));
		header("X-Error-Message: ".$message);
	}
893595
public function show_exception($oException)
    {
        $oErrorHandler = Factory::service('ErrorHandler');
        $sMessage      = implode(
            '; ',
            [
                'Code: ' . $oException->getCode(),
                'File: ' . $oException->getFile(),
                'Line: ' . $oException->getLine(),
            ]
        );
        $oErrorHandler->showFatalErrorScreen($oException->getMessage(), $sMessage);
    }
724181
public function handleExceptions($exception)
    {
        $this->displayError($exception);
        $this->sendErrorNotification($exception);

        if(isset($this->ApplicationContext) && ($this->ApplicationContext->isOneOffRedeploy() || $this->redeployOnError))
            $this->ApplicationContext->clearContextFiles();
    }
31983
public function exceptionHandler($exception)
    {
        $this->lastHandledException = $exception;

        $this->client->catchException($exception);

        if ($this->oldExceptionHandler) {
            call_user_func(
                $this->oldExceptionHandler,
                $exception
            );
        }
    }
816194
public static function exception( $exception ) 
	{
		// clean the main output buffer
		while ( ob_get_level() > 0 ) 
		{
			ob_end_clean();
		}
		
		$error_handler = "\\".CCCORE_NAMESPACE."\\CCError_Handler".( ClanCats::is_cli() ? '_Cli' : '' );
		$error_inspector = "\\".CCCORE_NAMESPACE."\\CCError_Inspector";
		
		if ( is_object( ClanCats::$config ) && ClanCats::$config instanceof CCConfig ) 
		{
			$error_handler = ClanCats::$config->get( 'error.'.( ClanCats::is_cli() ? 'cli_' : '' ).'handler', $error_handler );
			$error_inspector = ClanCats::$config->get( 'error.inspector', $error_inspector );
		}
		
		$inspector = new $error_inspector( $exception );
		
		$handler = new $error_handler( $inspector );
		
		$handler->handle();
	}
706599
public static function formatError(Error $exception)
    {
        $error = [
            'message' => $exception->getMessage(),
        ];

        $locations = $exception->getLocations();
        if (!empty($locations)) {
            $error['locations'] = array_map(function (SourceLocation $loc) {
                return $loc->toArray();
            }, $locations);
        }

        $previous = $exception->getPrevious();
        if ($previous && $previous instanceof ValidationException) {
            $error['validation'] = $previous->getResult()->getMessages();
        }

        return $error;
    }
1047008
protected function error(\Exception $e)
    {
        $str  = sprintf("Message: %s\r\n", $e->getMessage());
        $str .= sprintf("Code: %s\r\n", $e->getCode());
        $str .= sprintf("File: %s (line: %s)\r\n", $e->getFile(), $e->getLine());
        $str .= sprintf("Trade: %s\r\n", $e->getTraceAsString());

        if ($this->log instanceof \Closure)
        {
            $log = $this->log;
            $log($str);
        }
    }
128762
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);
		}
	}
334636
protected function logException(\Exception $exception): void
    {
        if (!$this->logger) {
            return;
        }

        $message = sprintf(
            'Exception thrown when handling an exception (%s: %s at %s line %s)',
            get_class($exception),
            $exception->getMessage(),
            $exception->getFile(),
            $exception->getLine()
        );

        $this->logger->log($this->level, $message, [
            'exception' => $exception,
        ]);
    }
862240
public static function exception_log($exception){
		LogMaster::log("!!!Uncaught Exception\nCode: " . $exception->getCode() . "\nMessage: " . $exception->getMessage());
		if (LogMaster::$_output){
			echo "<pre><xmp>\n";
			echo LogMaster::get_session_log();
			echo "\n</xmp></pre>";
		}
		die();
	}
1168309
public function exception($exception)
    {
        try {
            foreach ($this->handlers as $handler) {
                $handler($exception);
            }
        } catch (\Throwable $e) {
            $msg = "Infinity loop in exception & error handler. \nMessage:\n" . $e;

            if ($this->app->get('system.debug')) {
                exit($msg);
            }

            exit($e->getMessage());
        }

        exit();
    }
1098703
public function handleException(Exception $exception) {
        // untangle message from php7errorexception
        $message = $exception instanceof PHP7ErrorException ? $exception->getError()->getMessage(): $exception->getMessage();

        // send a debug mail with the exception
        if(!$this->debug && !in_array(get_class($exception), $this->_skipExceptions))
            $this->_email('CLI Exception', Misc::dump($exception, $message, true));

        // continue with exception handle logic
        parent::handleException($exception);
    }