Method to log the error

@param Request $request
@param Throwable $e
@return bool
160599
public function error(Request $request, Throwable $e)
    {
        $user = $this->getUser4Id($request->getUserId());

        $this->saveDonateLog($request, $user, $e->getMessage());

        return true;
    }
769737
public function report(Exception $e)
    {
        if ($this->shouldntReport($e)) {
            return;
        }

        if (method_exists($e, 'report')) {
            return $e->report();
        }

        try {
            $logger = $this->container->make(LoggerInterface::class);
        }
        catch (Exception $ex) {
            throw $e; // Throw the original exception
        }

        $logger->error($e);
    }
930618
protected function convertExceptionToResponse(Exception $e, Request $request)
    {
        $debug = Config::get('app.debug');

        //
        $e = FlattenException::create($e);

        $handler = new SymfonyExceptionHandler($debug);

        return SymfonyResponse::create($handler->getHtml($e), $e->getStatusCode(), $e->getHeaders());
    }
279599
public function error($e): void
  {
    $this->has_error = true;
    self::has_error();
    $msg = [
      self::$line,
      self::get_log_line('ERROR DB!'),
      self::$line
    ];
    if ( \is_string($e) ){
      $msg[] = self::get_log_line('USER MESSAGE');
      $msg[] = $e;
    }
    else if ( method_exists($e, 'getMessage') ){
      $msg[] = self::get_log_line('DB MESSAGE');
      $msg[] = $e->getMessage();
    }
    $this->last_error = end($msg);
    $msg[] = self::get_log_line('QUERY');
    $msg[] = $this->last();
    if ( $this->last_params['values'] ){
      $msg[] =  self::get_log_line('VALUES');
      foreach ( $this->last_params['values'] as $v ){
        if ( $v === null ){
          $msg[] = 'NULL';
        }
        else if ( \is_bool($v) ){
          $msg[] = $v ? 'TRUE' : 'FALSE';
        }
        else if ( \is_string($v) ){
          $msg[] = str::is_buid($v) ? bin2hex($v) : str::cut($v, 30);
        }
        else{
          $msg[] = $v;
        }
      }
    }
    $msg[] =  self::get_log_line('BACKTRACE');
    $dbt = array_reverse(debug_backtrace());
    array_walk($dbt, function($a, $i) use(&$msg){
      $msg[] = str_repeat(' ', $i).($i ? '->' : '')."{$a['function']}  (".basename(dirname($a['file'])).'/'.basename($a['file']).":{$a['line']})";
    });
    $this->log(implode(PHP_EOL, $msg));
    if ( $this->on_error === self::E_DIE ){
      die(\defined('BBN_IS_DEV') && BBN_IS_DEV ? '<pre>'.PHP_EOL.implode(PHP_EOL, $msg).PHP_EOL.'</pre>' : 'Database error');
    }
  }
533344
protected function invalid($request, ValidationException $e)
    {
        $url = $e->redirectTo ?? url()->previous();

        return redirect($url)
            ->withInput($request->except($this->dontFlash))
            ->withErrors($e->errors(), $e->errorBag);
    }
684744
public function toResponse($request)
    {
        if(! $this->handler && ! is_callable($this->handler)) {
            throw new ErrorException("No handler set");
        }

        $parameters = array_merge(
            [$request, $this->action],
            $this->parameters
        );

        try {
            $payload = call_user_func_array($this->handler, array_values($parameters));
        }
        catch (Exception $e) {
            // We'll assume that if an Exception has an error code 
            // that is explicitly defined, we want to use it as an
            // HTTP error code. if not we'll just let the 
            // Exception handler takes care of it. 
            $code = $e->getCode();

            if (! $this->isValidHttpStatusCode($code)) {
                throw $e;
            }
            
            $this->setStatusCode($code);

            return $e instanceof HasMessageBag 
                ? $this->respondWithMessageBag($e->getMessageBag(), class_basename($e))
                : $this->respondWithError($e->getMessage(), class_basename($e));
        }   
        catch (ValidationException $e) {
            throw $e;
        }

        return $this->handlePayload($payload);
    }
1050441
public static function wrapException(RequestInterface $request, \Exception $e)
    {
        return $e instanceof RequestException
            ? $e
            : new RequestException($e->getMessage(), $request, null, $e);
    }
920663
protected function renderException($request, Exception $e)
    {
        return $this->app[ExceptionHandler::class]->render($request, $e);
    }
197210
public function render($request, Exception $e)
	{
		if ($this->isHttpException($e))
		{
			return $this->renderHttpException($e);
		}
		else
		{
			return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
		}
	}
887840
public function render($request, Exception $e)
    {
        if (method_exists($e, 'render') && $response = $e->render($request)) {
            return Router::toResponse($request, $response);
        } elseif ($e instanceof Responsable) {
            return $e->toResponse($request);
        }

        $e = $this->prepareException($e);

        if ($e instanceof HttpResponseException) {
            return $e->getResponse();
        } elseif ($e instanceof AuthenticationException) {
            return $this->unauthenticated($request, $e);
        } elseif ($e instanceof ValidationException) {
            return $this->convertValidationExceptionToResponse($e, $request);
        }

        return $request->expectsJson()
                        ? $this->prepareJsonResponse($request, $e)
                        : $this->prepareResponse($request, $e);
    }
313103
protected function tokenMismatch($request, TokenMismatchException $e)
    {
        // check if Chronos path or app
        if ($request && ($request->is('admin') || $request->is('admin/*')))
            return response()->view("chronos::errors.token_mismatch", ['exception' => $e]);
        else
            return $this->convertExceptionToResponse($e);
    }
1161521
protected function removeErroredRequest(RequestInterface $request, \Exception $e = null, $buffer = true)
    {
        if ($buffer) {
            $this->exceptions[] = array('request' => $request, 'exception' => $e);
        }

        $this->remove($request);
        $this->dispatch(self::MULTI_EXCEPTION, array('exception' => $e, 'all_exceptions' => $this->exceptions));
    }
966003
public function render($request, Exception $e)
	{
		if ($e instanceof HttpException) {
			$response = $e->response();
			
			if ($request->header('Origin')) {
				Cors::attachHeaders($response);
				$response->headers->set('Access-Control-Allow-Origin', $request->header('Origin'));
			}
			
			return $response;
		}
		
		return parent::render($request, $e);
	}
307869
protected function handle404s($request, BaseException $e)
    {
        // Check for right exception
        if (!is_a($e, ModelNotFoundException::class) && !is_a($e, NotFoundHttpException::class)) {
            return;
        }

        // Check for a valid redirect
        if ($rule = RedirectRule::matchUsingRequest()->first()) {
            return redirect($rule->to, $rule->code);
        }

        // Return header only on AJAX
        if ($request->ajax()) {
            return response(null, 404);
        }
    }
94296
public function render($request, Exception $e)
    {
        $errors = [
            'message' => $e->getMessage(),
            'trace' => collect($e->getTrace())->map(function ($item) {
                return [
                    'file' => array_get($item, 'file'),
                    'line' => array_get($item, 'line'),
                    'method' => array_get($item, 'function'),
                ];
            })->toArray(),
        ];
        $this->debug->setError($errors)->broadcast();

        return $this->exceptionHandler->render($request, $e);
    }
411259
protected function logException($request, $exception) {
		if ($this->is404($exception, $request)) {
			$level = LOG_ERR;
			Log::write($level, $this->getMessage($request, $exception), ['404']);
			return;
		}

		parent::logException($request, $exception);
	}
91169
protected function invalidJson($request, ValidationException $e)
    {
        return response()->json([
            'message' => $e->getMessage(),
            'errors' => $e->errors()
        ], $e->status);
    }