Browse Source

Change code and type of consantUnknown exception

microsub
J. King 7 years ago
parent
commit
50185ab8f6
  1. 2
      lib/AbstractException.php
  2. 2
      lib/Database.php
  3. 3
      locale/en.php
  4. 2
      tests/lib/Database/SeriesArticle.php

2
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,

2
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");

3
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}',

2
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);
}

Loading…
Cancel
Save