2 Commits
5.0 ... 5.1

Author SHA1 Message Date
User
a2650ab53f 20250706#2 2025-07-06 20:12:09 +03:00
User
0558bb121d 20250706#1 2025-07-06 20:11:27 +03:00
2 changed files with 2 additions and 16 deletions

View File

@@ -9,5 +9,5 @@ composer create-project rmphp/skeleton project-name
```
```bash
composer create-project rmphp/skeleton:"^5.0" project-name
composer create-project rmphp/skeleton:"^5.1" project-name
```

View File

@@ -3,33 +3,19 @@
namespace Base\Controllers;
use Base\Application\ApplicationException;
use Base\Application\DTOException;
use Base\Domain\DomainException;
use Exception;
use Throwable;
abstract class AbstractPageController extends AbstractController {
/**
* @param Exception $exception
* @param array $data
* @return void
*/
public function exceptionPage(Exception $exception, array $data = []) : void {
$this->logException($exception, $data);
$this->syslogger()->warning($exception->getMessage()." on ".$exception->getFile().":".$exception->getLine(), $data);
$this->template()->setSubtemplate("main", "/error/errpage.tpl", [
"errorText" => "<span style='color:red'>Error: ".$exception->getMessage()." (".$exception->getCode().")"."</span>"
]);
}
/**
* @param Throwable $e
* @return string
*/
public function checkError(Throwable $e) : string {
($e instanceof Exception) ? $this->logException($e) : $this->logError($e);
if($e instanceof DTOException || $e instanceof DomainException || $e instanceof ApplicationException) return $e->getMessage();
if($e instanceof DomainException || $e instanceof ApplicationException) return $e->getMessage();
return "Ошибка. Дата и время: ".date("d-m-Y H:i:s");
}
}