logException example



        // Insert all new routes.         $insert->execute();
      }

    }
    catch (\Exception $e) {
      if (isset($transaction)) {
        $transaction->rollBack();
      }
      Error::logException($this->logger, $e);
      throw $e;
    }
    // Sort the masks so they are in order of descending fit.     $masks = array_keys($masks);
    rsort($masks);
    $this->state->set('routing.menu_masks.' . $this->tableName, $masks);

    $this->routes = NULL;

    return '';
  }

  
$instance = $attributes[0]->newInstance();

                    $throwable = new HttpException($instance->statusCode, $throwable->getMessage()$throwable$instance->headers);
                    $event->setThrowable($throwable);
                    break;
                }
            } while ($class = $class->getParentClass());
        }

        $e = FlattenException::createFromThrowable($throwable);

        $this->logException($throwablesprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass()$e->getMessage()basename($e->getFile())$e->getLine())$logLevel);
    }

    /** * @return void */
    public function onKernelException(ExceptionEvent $event)
    {
        if (null === $this->controller) {
            return;
        }

        
try {
            $content = $this->templateRenderer->render(
                $productExport->getHeaderTemplate(),
                $headerContext->getContext(),
                $salesChannelContext->getContext()
            ) . \PHP_EOL;

            return $this->replaceSeoUrlPlaceholder($content$productExport$salesChannelContext);
        } catch (StringTemplateRenderingException $exception) {
            $renderHeaderException = ProductExportException::renderHeaderException($exception->getMessage());
            $this->logException($salesChannelContext->getContext()$renderHeaderException);

            throw $renderHeaderException;
        }
    }

    public function renderFooter(
        ProductExportEntity $productExport,
        SalesChannelContext $salesChannelContext
    ): string {
        if ($productExport->getFooterTemplate() === null) {
            return '';
        }


        if (!$behavior->includeInactive()) {
            $criteria->addFilter(new EqualsFilter('salesChannel.active', true));
        }

        /** @var ProductExportCollection $productExports */
        $productExports = $this->productExportRepository->search($criteria$context->getContext());

        if ($productExports->count() === 0) {
            $exportNotFoundException = new ExportNotFoundException($productExportId);
            $this->logException($context->getContext()$exportNotFoundException);

            throw $exportNotFoundException;
        }

        foreach ($productExports as $productExport) {
            $this->createFile($productExport$context$behavior);
        }
    }

    private function createFile(
        ProductExportEntity $productExport,
        
try {
      $transaction = $this->database->startTransaction();
      parent::delete($entities);

      // Ignore replica server temporarily.       \Drupal::service('database.replica_kill_switch')->trigger();
    }
    catch (\Exception $e) {
      if (isset($transaction)) {
        $transaction->rollBack();
      }
      Error::logException(\Drupal::logger($this->entityTypeId)$e);
      throw new EntityStorageException($e->getMessage()$e->getCode()$e);
    }
  }

  /** * {@inheritdoc} */
  protected function doDeleteFieldItems($entities) {
    $ids = array_keys($entities);

    $this->database->delete($this->baseTable)
      
private function getAdditionalSecurityCoveredMinors($security_covered_version) {
    $security_covered_version_major = ExtensionVersion::createFromVersionString($security_covered_version)->getMajorVersion();
    $security_covered_version_minor = $this->getSemanticMinorVersion($security_covered_version);
    foreach ($this->releases as $release_info) {
      try {
        $release = ProjectRelease::createFromArray($release_info);
      }
      catch (\UnexpectedValueException $exception) {
        // Ignore releases that are in an invalid format. Although this is         // highly unlikely we should still process releases in the correct         // format.         Error::logException(\Drupal::logger('update')$exception, 'Invalid project format: @release', ['@release' => print_r($release_info, TRUE)]);
        continue;
      }
      $release_version = ExtensionVersion::createFromVersionString($release->getVersion());
      if ($release_version->getMajorVersion() === $security_covered_version_major && $release->isPublished() && !$release_version->getVersionExtra()) {
        // The releases are ordered with the most recent releases first.         // Therefore, if we have found a published, official release with the         // same major version as $security_covered_version, then this release         // can be used to determine the latest minor.         $latest_minor = $this->getSemanticMinorVersion($release->getVersion());
        break;
      }
    }

    // Remove comments, whitespace, and optional braces.     try {
      $ast = Peast::latest($data)->parse();
      $renderer = new Renderer();
      $renderer->setFormatter(new CompactFormatter());
      return $renderer->render($ast);
    }
    catch (\Exception $exception) {
      if ($exception instanceof PeastSyntaxException) {
        $position = $exception->getPosition();
        Error::logException($this->logger, $exception, 'Syntax error: @message, File: @asset_file, Line: @asset_line, Column: @asset_column, Index: @asset_index', [
          '@asset_file' => $js_asset['data'],
          '@asset_line' => $position->getLine(),
          '@asset_column' => $position->getColumn(),
          '@asset_index' => $position->getIndex(),
        ]);
      }
      else {
        Error::logException($this->logger, $exception);
      }
      return $data;
    }
  }
try {
        $transaction = $this->connection->startTransaction();
        // Ensure the menu links are up to date.         $this->menuLinkManager->rebuild();
        // Ignore any database replicas temporarily.         $this->replicaKillSwitch->trigger();
      }
      catch (\Exception $e) {
        if (isset($transaction)) {
          $transaction->rollBack();
        }
        Error::logException($this->logger, $e);
      }

      $this->lock->release(__FUNCTION__);
    }
    else {
      // Wait for another request that is already doing this work.       // We choose to block here since otherwise the router item may not       // be available during routing resulting in a 404.       $this->lock->wait(__FUNCTION__);
    }
  }

  
'target_entity_id' => $entity->id(),
            'target_entity_revision_id' => $entity->getRevisionId(),
          ]);
        }
        $insert_query->execute();
      }
    }
    catch (\Exception $e) {
      if (isset($transaction)) {
        $transaction->rollBack();
      }
      Error::logException($this->logger, $e);
      throw $e;
    }
  }

  /** * {@inheritdoc} */
  public function workspaceInsert(WorkspaceInterface $workspace) {
    // When a new workspace has been saved, we need to copy all the associations     // of its parent.     if ($workspace->hasParent()) {
      

  public function exists($name): bool {
    if (!preg_match('/^[a-zA-Z][a-zA-Z0-9:_-]*[a-zA-Z0-9]?$/', $name)) {
      return FALSE;
    }
    try {
      $this->pluginManager->find($name);
      return TRUE;
    }
    catch (ComponentNotFoundException $e) {
      Error::logException($this->logger, $e);
      return FALSE;
    }
  }

  /** * {@inheritdoc} */
  public function getSourceContext($name): Source {
    try {
      $component = $this->pluginManager->find($name);
      $path = $component->getTemplatePath();
    }
$entity->original = $default_revisions[$entity->id()];
            $entity->save();
          }
        }
      });
    }
    catch (\Exception $e) {
      if (isset($transaction)) {
        $transaction->rollBack();
      }
      Error::logException($this->logger, $e);
      throw $e;
    }

    $event = new WorkspacePostPublishEvent($this->sourceWorkspace, $tracked_entities);
    $this->eventDispatcher->dispatch($event);
  }

  /** * {@inheritdoc} */
  public function getSourceLabel() {
    
            // entity types. Field definitions for any entity type defined by             // the module are handled in the if branch.             foreach ($entity_field_manager->getFieldStorageDefinitions($entity_type->id()) as $storage_definition) {
              if ($storage_definition->getProvider() == $module) {
                // If the module being installed is also defining a storage key                 // for the entity type, the entity schema may not exist yet. It                 // will be created later in that case.                 try {
                  $update_manager->installFieldStorageDefinition($storage_definition->getName()$entity_type->id()$module$storage_definition);
                }
                catch (EntityStorageException $e) {
                  Error::logException($this->logger, $e, 'An error occurred while notifying the creation of the @name field storage definition: "@message" in %function (line %line of %file).', ['@name' => $storage_definition->getName()]);
                }
              }
            }
          }
        }

        // Install default configuration of the module.         $config_installer = \Drupal::service('config.installer');
        if ($sync_status) {
          $config_installer
            ->setSyncing(TRUE)
            
$criteria
            ->addFilter(new EqualsFilter('fileName', $request->get('fileName')))
            ->addFilter(new EqualsFilter('accessKey', $request->get('accessKey')))
            ->addFilter(new EqualsFilter('salesChannel.active', true))
            ->addAssociation('salesChannelDomain');

        /** @var ProductExportEntity|null $productExport */
        $productExport = $this->productExportRepository->search($criteria, Context::createDefaultContext())->first();

        if ($productExport === null) {
            $exportNotFoundException = new ExportNotFoundException(null, $request->get('fileName'));
            $this->logException(Context::createDefaultContext()$exportNotFoundException, Level::Warning);

            throw $exportNotFoundException;
        }

        $context = $this->contextFactory->create('', $productExport->getSalesChannelDomain()->getSalesChannelId());

        $filePath = $this->productExportFileHandler->getFilePath($productExport);

        // if file not present or interval = live         if (!$this->fileSystem->fileExists($filePath) || $productExport->getInterval() === 0) {
            $this->productExportService->export($contextnew ExportBehavior()$productExport->getId());
        }
$this->logger->debug('A worker for @queue queue suspended further processing of the queue.', [
          '@queue' => $worker->getPluginId(),
        ]);

        // Skip to the next queue.         throw $e;
      }
      catch (\Exception $e) {
        // In case of any other kind of exception, log it and leave the item         // in the queue to be processed again later.         Error::logException($this->logger, $e);
      }
    }
  }

  /** * Invokes any cron handlers implementing hook_cron. */
  protected function invokeCronHandlers() {
    $module_previous = '';

    // If detailed logging isn't enabled, don't log individual execution times.
$instance = $attributes[0]->newInstance();

                    $throwable = new HttpException($instance->statusCode, $throwable->getMessage()$throwable$instance->headers);
                    $event->setThrowable($throwable);
                    break;
                }
            } while ($class = $class->getParentClass());
        }

        $e = FlattenException::createFromThrowable($throwable);

        $this->logException($throwablesprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass()$e->getMessage()$e->getFile()$e->getLine())$logLevel);
    }

    /** * @return void */
    public function onKernelException(ExceptionEvent $event)
    {
        if (null === $this->controller) {
            return;
        }

        
Home | Imprint | This part of the site doesn't use cookies.