https://hephaestos.net/fr/register

Exceptions

Response status is 400 instead of subscribed

Exception

Symfony\Component\HttpKernel\Exception\ BadRequestHttpException

  1. $concatenatedList
  2. )
  3. );
  4. }
  5. if ($response['status'] !== 'subscribed') {
  6. throw new BadRequestHttpException(
  7. sprintf('Response status is %s instead of %s', $response['status'], 'subscribed')
  8. );
  9. }
  10. }
  1. throw new UnauthorizedHttpException('Mailchimp', $response['detail']);
  2. }
  3. if (Response::HTTP_NOT_FOUND === $response['status']) {
  4. $this->exportNewEmail($email);
  5. }
  6. }
  7. private function getListMemberEndpoint(string $email = null): string
  8. {
  1. if (!$customer instanceof CustomerInterface) {
  2. $customer = $this->createNewCustomer($email);
  3. }
  4. $this->addMailchimpData($email);
  5. $customer->setSubscribedToNewsletter(true);
  6. $this->customerManager->flush();
  7. }
  1. }
  2. private function subscribe(CustomerInterface $customer): void
  3. {
  4. if (null !== $customer->getEmail()) {
  5. $this->newsletterSubscriptionHandler->subscribe($customer->getEmail());
  6. }
  7. }
  8. private function unsubscribe(CustomerInterface $customer): void
  9. {
  1. $customer,
  2. CustomerInterface::class
  3. );
  4. }
  5. $customer->isSubscribedToNewsletter() === false ? $this->unsubscribe($customer) : $this->subscribe($customer);
  6. }
  7. public function customerPostUpdateEvent(GenericEvent $event): void
  8. {
  9. $this->customerCreateEvent($event);
  1. $this->priority = $dispatcher->getListenerPriority($eventName, $this->listener);
  2. $e = $this->stopwatch->start($this->name, 'event_listener');
  3. try {
  4. ($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
  5. } finally {
  6. if ($e->isStarted()) {
  7. $e->stop();
  8. }
  9. }
  1. foreach ($listeners as $listener) {
  2. if ($stoppable && $event->isPropagationStopped()) {
  3. break;
  4. }
  5. $listener($event, $eventName, $this);
  6. }
  7. }
  8. /**
  9. * Sorts the internal list of listeners for the given event by priority.
  1. } else {
  2. $listeners = $this->getListeners($eventName);
  3. }
  4. if ($listeners) {
  5. $this->callListeners($listeners, $eventName, $event);
  6. }
  7. return $event;
  8. }
  1. try {
  2. $this->beforeDispatch($eventName, $event);
  3. try {
  4. $e = $this->stopwatch->start($eventName, 'section');
  5. try {
  6. $this->dispatcher->dispatch($event, $eventName);
  7. } finally {
  8. if ($e->isStarted()) {
  9. $e->stop();
  10. }
  11. }
  1. ): ResourceControllerEvent {
  2. $eventName = $requestConfiguration->getEvent() ?: $eventName;
  3. $metadata = $requestConfiguration->getMetadata();
  4. $event = new ResourceControllerEvent($resource);
  5. $this->eventDispatcher->dispatch($event, sprintf('%s.%s.post_%s', $metadata->getApplicationName(), $metadata->getName(), $eventName));
  6. return $event;
  7. }
  8. public function dispatchInitializeEvent(
  1. if ($configuration->isHtmlRequest()) {
  2. $this->flashHelper->addSuccessFlash($configuration, ResourceActions::CREATE, $newResource);
  3. }
  4. $postEvent = $this->eventDispatcher->dispatchPostEvent(ResourceActions::CREATE, $configuration, $newResource);
  5. if (!$configuration->isHtmlRequest()) {
  6. return $this->createRestView($configuration, $newResource, Response::HTTP_CREATED);
  7. }
in vendor/symfony/http-kernel/HttpKernel.php -> createAction (line 163)
  1. $this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
  2. $controller = $event->getController();
  3. $arguments = $event->getArguments();
  4. // call controller
  5. $response = $controller(...$arguments);
  6. // view
  7. if (!$response instanceof Response) {
  8. $event = new ViewEvent($this, $request, $type, $response);
  9. $this->dispatcher->dispatch($event, KernelEvents::VIEW);
  1. {
  2. $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3. $this->requestStack->push($request);
  4. try {
  5. return $this->handleRaw($request, $type);
  6. } catch (\Exception $e) {
  7. if ($e instanceof RequestExceptionInterface) {
  8. $e = new BadRequestHttpException($e->getMessage(), $e);
  9. }
  10. if (false === $catch) {
  1. $this->boot();
  2. ++$this->requestStackSize;
  3. $this->resetServices = true;
  4. try {
  5. return $this->getHttpKernel()->handle($request, $type, $catch);
  6. } finally {
  7. --$this->requestStackSize;
  8. }
  9. }
Kernel->handle() in public/index.php (line 25)
  1. Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request = Request::createFromGlobals();
  5. $response = $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request, $response);

Logs

No log messages

Stack Trace

BadRequestHttpException
Symfony\Component\HttpKernel\Exception\BadRequestHttpException:
Response status is 400 instead of subscribed

  at vendor/bitbag/mailchimp-plugin/src/Handler/NewsletterSubscriptionHandler.php:148
  at BitBag\SyliusMailChimpPlugin\Handler\NewsletterSubscriptionHandler->exportNewEmail()
     (vendor/bitbag/mailchimp-plugin/src/Handler/NewsletterSubscriptionHandler.php:185)
  at BitBag\SyliusMailChimpPlugin\Handler\NewsletterSubscriptionHandler->addMailchimpData()
     (vendor/bitbag/mailchimp-plugin/src/Handler/NewsletterSubscriptionHandler.php:66)
  at BitBag\SyliusMailChimpPlugin\Handler\NewsletterSubscriptionHandler->subscribe()
     (vendor/bitbag/mailchimp-plugin/src/EventListener/CustomerNewsletterListener.php:77)
  at BitBag\SyliusMailChimpPlugin\EventListener\CustomerNewsletterListener->subscribe()
     (vendor/bitbag/mailchimp-plugin/src/EventListener/CustomerNewsletterListener.php:44)
  at BitBag\SyliusMailChimpPlugin\EventListener\CustomerNewsletterListener->customerCreateEvent()
     (vendor/symfony/event-dispatcher/Debug/WrappedListener.php:118)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:230)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:59)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:154)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (vendor/sylius/resource-bundle/src/Bundle/Controller/EventDispatcher.php:80)
  at Sylius\Bundle\ResourceBundle\Controller\EventDispatcher->dispatchPostEvent()
     (vendor/sylius/resource-bundle/src/Bundle/Controller/ResourceController.php:202)
  at Sylius\Bundle\ResourceBundle\Controller\ResourceController->createAction()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)