Handle exceptions.

This commit is contained in:
Igor Barkov (iwork)
2020-06-23 14:36:33 +03:00
parent e6056ae34a
commit 50f04b3a3c
2 changed files with 18 additions and 33 deletions
-16
View File
@@ -31,22 +31,6 @@ spl_autoload_register(function ($class_name) {
include_once 'classes/' . $class_name . '.php';
});
/**
* Выбрасыватель ошибок для запросов в базу
*/
function mysql_error_handler($query) {
try {
$query;
} catch (\Krugozor\Database\Mysql\Exception $e) {
echo <<<MYSQL_ERROR
<div style="background-color: #eecccc; border: 1px solid #eeaaaa; padding: 1em; font-size: 0.5em;">
<strong style="color: #8F0000">DB Error:</strong> {$e->getMessage()}<br>
<strong>File:</strong> {$e->getFile()} ({$e->getLine()})
</div>
MYSQL_ERROR;
}
}
/* === Для нападалок. Сперва комнаты в которых нельзя напасть, потом персонаж на которого нельзя напасть. === */
$unkilable = [
'rooms' => [620, 621, 1051, 1052],