Fixed error reporting in Hanyuu.
This commit is contained in:
parent
67d86e4d0b
commit
0a86525c9d
2 changed files with 6 additions and 18 deletions
16
hanyuu.php
16
hanyuu.php
|
@ -32,25 +32,11 @@ if($cfg->hasValues('sentry:dsn'))
|
||||||
'traces_sample_rate' => $cfg->getFloat('tracesRate', 0.2),
|
'traces_sample_rate' => $cfg->getFloat('tracesRate', 0.2),
|
||||||
'profiles_sample_rate' => $cfg->getFloat('profilesRate', 0.2),
|
'profiles_sample_rate' => $cfg->getFloat('profilesRate', 0.2),
|
||||||
]);
|
]);
|
||||||
})($cfg->scopeTo('sentry'));
|
|
||||||
|
|
||||||
set_exception_handler(function(\Throwable $ex) {
|
set_exception_handler(function(\Throwable $ex) {
|
||||||
\Sentry\captureException($ex);
|
\Sentry\captureException($ex);
|
||||||
|
|
||||||
if(HAU_CLI)
|
|
||||||
die((string)$ex);
|
|
||||||
|
|
||||||
http_response_code(500);
|
|
||||||
ob_clean();
|
|
||||||
|
|
||||||
if(HAU_DEBUG) {
|
|
||||||
header('Content-Type: text/plain; charset=utf-8');
|
|
||||||
die((string)$ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Content-Type: text/html; charset-utf-8');
|
|
||||||
die('<h2>Hanyuu is sad.</h2>');
|
|
||||||
});
|
});
|
||||||
|
})($cfg->scopeTo('sentry'));
|
||||||
|
|
||||||
$dbc = DbTools::create($cfg->getString('database:dsn', 'null'));
|
$dbc = DbTools::create($cfg->getString('database:dsn', 'null'));
|
||||||
$dbc->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\';');
|
$dbc->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\';');
|
||||||
|
|
|
@ -4,6 +4,8 @@ namespace Hanyuu;
|
||||||
require_once __DIR__ . '/../hanyuu.php';
|
require_once __DIR__ . '/../hanyuu.php';
|
||||||
|
|
||||||
set_exception_handler(function(\Throwable $ex) {
|
set_exception_handler(function(\Throwable $ex) {
|
||||||
|
\Sentry\captureException($ex);
|
||||||
|
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue