Skip to content

Commit

Permalink
fix: Fixed maintenance mode exception when using API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Feb 21, 2024
1 parent 1e05787 commit 02f0457
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/RoadizCoreBundle/src/Exception/MaintenanceModeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
namespace RZ\Roadiz\CoreBundle\Exception;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;

class MaintenanceModeException extends \Exception
class MaintenanceModeException extends ServiceUnavailableHttpException
{
protected AbstractController $controller;
protected ?AbstractController $controller;

/**
* @return AbstractController
*/
public function getController(): AbstractController
public function getController(): ?AbstractController
{
return $this->controller;
}
Expand All @@ -28,12 +26,12 @@ public function getController(): AbstractController
* @param string $message
* @param int $code
*/
public function __construct(AbstractController $controller = null, $message = null, $code = 0)
public function __construct(?AbstractController $controller = null, $message = null, $code = 0)
{
if (null !== $message) {
parent::__construct($message, $code);
parent::__construct(null, $message, null, $code);
} else {
parent::__construct($this->message, $code);
parent::__construct(null, $this->message, null, $code);
}

$this->controller = $controller;
Expand Down

0 comments on commit 02f0457

Please sign in to comment.