<?php
namespace Docuform\Api\Exception;

use Nyholm\Psr7\ServerRequest;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Exception\HttpInternalServerErrorException;

class ApiHttpDatabaseErrorException extends HttpInternalServerErrorException
{
  protected $message = 'Database error.';
  protected string $title = '500 Database Error';
  public function __construct(ServerRequestInterface|null $request = null, string|null $messageText = null, string|null $description = null)
  {
    if ($messageText)
      $this->message = $messageText;

    if ($description)
      $this->description = $description;

    parent::__construct($request ? $request : new ServerRequest('', ''), $this->message, null);
  }
}
