diff --git a/lib/AbstractException.php b/lib/AbstractException.php index 5c7ec40d..0806a135 100644 --- a/lib/AbstractException.php +++ b/lib/AbstractException.php @@ -10,6 +10,7 @@ abstract class AbstractException extends \Exception { const CODES = [ "Exception.uncoded" => -1, "Exception.unknown" => 10000, + "Exception.constantUnknown" => 10001, "ExceptionType.strictFailure" => 10011, "ExceptionType.typeUnknown" => 10012, "Lang/Exception.defaultFileMissing" => 10101, @@ -41,7 +42,6 @@ abstract class AbstractException extends \Exception { "Db/Exception.savepointInvalid" => 10226, "Db/Exception.savepointStale" => 10227, "Db/Exception.resultReused" => 10228, - "Db/Exception.constantUnknown" => 10229, "Db/ExceptionInput.missing" => 10231, "Db/ExceptionInput.whitespace" => 10232, "Db/ExceptionInput.tooLong" => 10233, diff --git a/lib/Database.php b/lib/Database.php index d67f386c..00cd3ca0 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -1019,7 +1019,7 @@ class Database { // id, subscription, feed, modified_date, marked_date, unread, starred, edition break; default: - throw new Db\Exception("constantUnknown", $fields); + throw new Exception("constantUnknown", $fields); } $q = $this->articleQuery($user, $context, $columns); $q->setJoin("left join arsse_enclosures on arsse_enclosures.article is arsse_articles.id"); diff --git a/locale/en.php b/locale/en.php index f2f21486..e2848473 100644 --- a/locale/en.php +++ b/locale/en.php @@ -85,6 +85,8 @@ return [ 'Exception.JKingWeb/Arsse/Exception.uncoded' => 'The specified exception symbol {0} has no code specified in AbstractException.php', // this should not usually be encountered 'Exception.JKingWeb/Arsse/Exception.unknown' => 'An unknown error has occurred', + // indicates programming error + 'Exception.JKingWeb/Arsse/Exception.constantUnknown' => 'Supplied constant value ({0}) is unknown or invalid in the context in which it was used', 'Exception.JKingWeb/Arsse/ExceptionType.strictFailure' => 'Supplied value could not be normalized to {0, select, 1 {null} 2 {boolean} @@ -142,7 +144,6 @@ return [ 'Exception.JKingWeb/Arsse/Db/Exception.savepointInvalid' => 'Tried to {action} invalid savepoint {index}', 'Exception.JKingWeb/Arsse/Db/Exception.savepointStale' => 'Tried to {action} stale savepoint {index}', 'Exception.JKingWeb/Arsse/Db/Exception.resultReused' => 'Result set already iterated', - 'Exception.JKingWeb/Arsse/Db/Exception.constantUnknown' => 'Supplied constant value ({0}) is unknown or invalid in the context in which it was used', 'Exception.JKingWeb/Arsse/Db/ExceptionInput.missing' => 'Required field "{field}" missing while performing action "{action}"', 'Exception.JKingWeb/Arsse/Db/ExceptionInput.whitespace' => 'Field "{field}" of action "{action}" may not contain only whitespace', 'Exception.JKingWeb/Arsse/Db/ExceptionInput.tooLong' => 'Field "{field}" of action "{action}" has a maximum length of {max}', diff --git a/tests/lib/Database/SeriesArticle.php b/tests/lib/Database/SeriesArticle.php index afab6110..9fcbbbf8 100644 --- a/tests/lib/Database/SeriesArticle.php +++ b/tests/lib/Database/SeriesArticle.php @@ -474,7 +474,7 @@ trait SeriesArticle { $this->assertEquals($columns, $test, "Fields do not match expectation for verbosity $constant"); } // check that an unknown fieldset produces an exception - $this->assertException("constantUnknown", "Db", "Exception"); + $this->assertException("constantUnknown"); Arsse::$db->articleList($this->user, (new Context)->article(101), \PHP_INT_MAX); }