Skip to content

Commit 7cf12c2

Browse files
committed
change log message for client errors
1 parent fc96a75 commit 7cf12c2

4 files changed

Lines changed: 5 additions & 6 deletions

File tree

core/API/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public function process()
285285
});
286286
} catch (Exception $e) {
287287
if ($e instanceof HttpCodeException && $e->getCode() >= 400 && $e->getCode() < 500) {
288-
StaticContainer::get(LoggerInterface::class)->debug('Uncaught exception in API: {exception}', [
288+
StaticContainer::get(LoggerInterface::class)->debug('Uncaught client error in API: {exception}', [
289289
'exception' => $e,
290290
'ignoreInScreenWriter' => true,
291291
]);

core/Exception/ThingNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ class ThingNotFoundException extends \Piwik\Exception\Exception implements HttpC
1515
{
1616
public function __construct($message, $previous = null)
1717
{
18-
parent::__construct($message, 400, $previous);
18+
parent::__construct($message, 404, $previous);
1919
}
2020
}

core/FrontController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Piwik\Plugins\CoreAdminHome\CustomLogo;
2828
use Piwik\Session\SessionAuth;
2929
use Piwik\Session\SessionInitializer;
30-
use Piwik\SupportedBrowser;
3130
use Piwik\Log\LoggerInterface;
3231

3332
/**
@@ -116,7 +115,7 @@ private static function generateSafeModeOutputFromError($lastError)
116115
public static function generateSafeModeOutputFromException($e)
117116
{
118117
if ($e instanceof HttpCodeException && $e->getCode() >= 400 && $e->getCode() < 500) {
119-
StaticContainer::get(LoggerInterface::class)->debug('Uncaught exception: {exception}', [
118+
StaticContainer::get(LoggerInterface::class)->debug('Uncaught client error: {exception}', [
120119
'exception' => $e,
121120
'ignoreInScreenWriter' => true,
122121
]);

tests/PHPUnit/Integration/AssetManager/UIAssetFetcher/PluginUmdAssetFetcherTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
use Piwik\AssetManager\UIAsset\OnDiskUIAsset;
1313
use Piwik\AssetManager\UIAssetFetcher\Chunk;
1414
use Piwik\AssetManager\UIAssetFetcher\PluginUmdAssetFetcher;
15+
use Piwik\Exception\ThingNotFoundException;
1516
use Piwik\Filesystem;
16-
use Piwik\Http\BadRequestException;
1717
use Piwik\Plugin\Manager;
1818
use Piwik\Tests\Framework\TestCase\UnitTestCase;
1919

@@ -178,7 +178,7 @@ public function testGetChunkFilesThrows404WhenChunkIsMissing()
178178
$plugins = array_keys(self::TEST_PLUGIN_DEPENDENCIES);
179179
$instance = new PluginUmdAssetFetcher($plugins, null, 'does-not-exist', false);
180180

181-
$this->expectException(BadRequestException::class);
181+
$this->expectException(ThingNotFoundException::class);
182182
$this->expectExceptionCode(404);
183183

184184
$instance->getCatalog();

0 commit comments

Comments
 (0)