2017-08-31 11:14:21 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Exceptions;
|
|
|
|
|
|
|
|
use Exception;
|
2019-03-13 20:12:03 -07:00
|
|
|
|
2017-08-31 11:14:21 -07:00
|
|
|
class CheckoutNotAllowed extends Exception
|
|
|
|
{
|
2018-07-16 17:44:03 -07:00
|
|
|
private $errorMessage;
|
|
|
|
|
2021-06-10 13:15:52 -07:00
|
|
|
public function __construct($errorMessage = null)
|
2018-07-16 17:44:03 -07:00
|
|
|
{
|
|
|
|
$this->errorMessage = $errorMessage;
|
|
|
|
|
|
|
|
parent::__construct($errorMessage);
|
|
|
|
}
|
2021-06-10 13:15:52 -07:00
|
|
|
|
2017-08-31 11:14:21 -07:00
|
|
|
public function __toString()
|
|
|
|
{
|
2021-06-10 13:15:52 -07:00
|
|
|
return is_null($this->errorMessage) ? 'A checkout is not allowed under these circumstances' : $this->errorMessage;
|
2017-08-31 11:14:21 -07:00
|
|
|
}
|
|
|
|
}
|