Fixed error reporting in Hanyuu.
This commit is contained in:
parent
67d86e4d0b
commit
0a86525c9d
2 changed files with 6 additions and 18 deletions
22
hanyuu.php
22
hanyuu.php
|
@ -32,26 +32,12 @@ if($cfg->hasValues('sentry:dsn'))
|
|||
'traces_sample_rate' => $cfg->getFloat('tracesRate', 0.2),
|
||||
'profiles_sample_rate' => $cfg->getFloat('profilesRate', 0.2),
|
||||
]);
|
||||
|
||||
set_exception_handler(function(\Throwable $ex) {
|
||||
\Sentry\captureException($ex);
|
||||
});
|
||||
})($cfg->scopeTo('sentry'));
|
||||
|
||||
set_exception_handler(function(\Throwable $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>');
|
||||
});
|
||||
|
||||
$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\';');
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ namespace Hanyuu;
|
|||
require_once __DIR__ . '/../hanyuu.php';
|
||||
|
||||
set_exception_handler(function(\Throwable $ex) {
|
||||
\Sentry\captureException($ex);
|
||||
|
||||
http_response_code(500);
|
||||
ob_clean();
|
||||
|
||||
|
|
Loading…
Reference in a new issue