diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index dae8ae91..9bd38444 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -78,15 +78,10 @@ class Handler extends ExceptionHandler { $data = $request->all(); $httpStatusCode = $this->getHttpStatusCode($e); - if ($httpStatusCode == 200) { - $msg = $e->getMessage() ?: get_class($e); - } else { - $msg = 'Server Error'; - } $msg = $e->getMessage(); $trace = $e->getTraceAsString(); if (config('app.debug')) { - $data['trace'] = $e->getTraceAsString(); + $data['trace'] = $trace; } return new JsonResponse( fail($msg, $data), diff --git a/app/Http/Controllers/PollController.php b/app/Http/Controllers/PollController.php index 61b53ddb..47dbb441 100644 --- a/app/Http/Controllers/PollController.php +++ b/app/Http/Controllers/PollController.php @@ -128,7 +128,7 @@ class PollController extends Controller ->selectRaw("selection, count(*) as count")->groupBy("selection") ->get()->pluck('count', 'selection')->toArray(); foreach ($answerStats as $index => &$value) { - $value = number_format(($value / $poll->answers_count) * 100, 2) . '%'; + $value = number_format(($value / $poll->answers_count) * 100, 1) . '%'; } $resource = new PollResource($poll); } else { diff --git a/config/logging.php b/config/logging.php index c3415176..afefa71f 100644 --- a/config/logging.php +++ b/config/logging.php @@ -46,6 +46,7 @@ return [ 'tap' => [\App\Logging\NexusFormatter::class], 'path' => env('LOG_FILE', '/tmp/nexus.log'), 'level' => env('LOG_LEVEL', 'debug'), + 'ignore_exceptions' => false, ], 'daily' => [ @@ -54,6 +55,7 @@ return [ 'level' => env('LOG_LEVEL', 'debug'), 'tap' => [\App\Logging\NexusFormatter::class], 'days' => 14, + 'ignore_exceptions' => false, ], 'slack' => [ @@ -79,6 +81,8 @@ return [ 'level' => env('LOG_LEVEL', 'debug'), 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), + 'ignore_exceptions' => false, + 'tap' => [\App\Logging\NexusFormatter::class], 'with' => [ 'stream' => 'php://stderr', ], diff --git a/include/constants.php b/include/constants.php index b7e2c693..7187ec95 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ setLanguageFolderArray(get_langfolder_list()); require $rootpath . 'include/config.php'; -if (!in_array(nexus()->getScript(), ['announce', 'scrape', 'torrentrss', 'download'])) { +if (!isRunningInConsole() && !in_array(nexus()->getScript(), ['announce', 'scrape', 'torrentrss', 'download'])) { require $rootpath . get_langfile_path("functions.php"); checkGuestVisit(); }