Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user