Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1106b4af47 | ||
|
|
a2650ab53f | ||
|
|
0558bb121d |
@@ -9,5 +9,5 @@ composer create-project rmphp/skeleton project-name
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer create-project rmphp/skeleton:"^5.0" project-name
|
composer create-project rmphp/skeleton:"^5.1" project-name
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -3,33 +3,19 @@
|
|||||||
namespace Base\Controllers;
|
namespace Base\Controllers;
|
||||||
|
|
||||||
use Base\Application\ApplicationException;
|
use Base\Application\ApplicationException;
|
||||||
use Base\Application\DTOException;
|
|
||||||
use Base\Domain\DomainException;
|
use Base\Domain\DomainException;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
abstract class AbstractPageController extends AbstractController {
|
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
|
* @param Throwable $e
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function checkError(Throwable $e) : string {
|
public function checkError(Throwable $e) : string {
|
||||||
($e instanceof Exception) ? $this->logException($e) : $this->logError($e);
|
($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");
|
return "Ошибка. Дата и время: ".date("d-m-Y H:i:s");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,17 @@
|
|||||||
"php": "^8.3",
|
"php": "^8.3",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-yaml": "*",
|
"ext-yaml": "*",
|
||||||
"laminas/laminas-diactoros": "^2.5",
|
"laminas/laminas-diactoros": "^2.26",
|
||||||
"monolog/monolog": "^2.3",
|
"monolog/monolog": "^2.10",
|
||||||
"php-di/php-di": "^6.3",
|
"php-di/php-di": "^6.4",
|
||||||
"ramsey/uuid": "^4.7",
|
"ramsey/uuid": "^4.9",
|
||||||
"rmphp/content": "^4.0",
|
"rmphp/content": "^4.1",
|
||||||
"rmphp/kernel": "^6.0",
|
"rmphp/kernel": "^6.1",
|
||||||
"rmphp/router": "^2.0",
|
"rmphp/router": "^2.1",
|
||||||
"rmphp/session": "^1.1",
|
"rmphp/session": "^1.1",
|
||||||
"rmphp/redis": "^1.0",
|
"rmphp/redis": "^1.0",
|
||||||
"rmphp/storage": "^12.0",
|
"rmphp/storage": "^12.0",
|
||||||
"symfony/dotenv": "^6.2"
|
"symfony/dotenv": "^6.4"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"process-timeout":0
|
"process-timeout":0
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/var-dumper": "^5.3",
|
"symfony/var-dumper": "^5.4",
|
||||||
"rmphp/var-damper": "^1.0"
|
"rmphp/var-damper": "^1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user