Первый коммит
This commit is contained in:
29
VkApiException.php
Normal file
29
VkApiException.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace VK;
|
||||
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
class VkApiException extends Exception {
|
||||
|
||||
public function __construct($message = "", $code = 0, Throwable $previous = null) {
|
||||
//echo "\n".$this->__toString()."\n";
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
$error = "[Exception]: возникла ошибка:";
|
||||
$error .= "\r\n[Exception]: текст: {$this->getMessage()}";
|
||||
$error .= "\r\n[Exception]: код ошибки: {$this->getCode()}";
|
||||
$error .= "\r\n[Exception]: файл: {$this->getFile()}:{$this->getLine()}";
|
||||
$error .= "\r\n[Exception]: путь ошибки: {$this->getTraceAsString()}\r\n";
|
||||
if (!is_dir('error'))
|
||||
mkdir('error');
|
||||
$file = fopen('error/error_log' . date('d-m-Y_h') . ".log", 'a');
|
||||
fwrite($file, $error);
|
||||
fclose($file);
|
||||
// exit();
|
||||
return $error;
|
||||
// parent::__toString(); // TODO: Change the autogenerated stub
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user