1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Change code and type of consantUnknown exception

This commit is contained in:
J. King 2017-11-17 22:53:54 -05:00
parent b0da9a1d06
commit 50185ab8f6
4 changed files with 5 additions and 4 deletions

View file

@ -10,6 +10,7 @@ abstract class AbstractException extends \Exception {
const CODES = [ const CODES = [
"Exception.uncoded" => -1, "Exception.uncoded" => -1,
"Exception.unknown" => 10000, "Exception.unknown" => 10000,
"Exception.constantUnknown" => 10001,
"ExceptionType.strictFailure" => 10011, "ExceptionType.strictFailure" => 10011,
"ExceptionType.typeUnknown" => 10012, "ExceptionType.typeUnknown" => 10012,
"Lang/Exception.defaultFileMissing" => 10101, "Lang/Exception.defaultFileMissing" => 10101,
@ -41,7 +42,6 @@ abstract class AbstractException extends \Exception {
"Db/Exception.savepointInvalid" => 10226, "Db/Exception.savepointInvalid" => 10226,
"Db/Exception.savepointStale" => 10227, "Db/Exception.savepointStale" => 10227,
"Db/Exception.resultReused" => 10228, "Db/Exception.resultReused" => 10228,
"Db/Exception.constantUnknown" => 10229,
"Db/ExceptionInput.missing" => 10231, "Db/ExceptionInput.missing" => 10231,
"Db/ExceptionInput.whitespace" => 10232, "Db/ExceptionInput.whitespace" => 10232,
"Db/ExceptionInput.tooLong" => 10233, "Db/ExceptionInput.tooLong" => 10233,

View file

@ -1019,7 +1019,7 @@ class Database {
// id, subscription, feed, modified_date, marked_date, unread, starred, edition // id, subscription, feed, modified_date, marked_date, unread, starred, edition
break; break;
default: default:
throw new Db\Exception("constantUnknown", $fields); throw new Exception("constantUnknown", $fields);
} }
$q = $this->articleQuery($user, $context, $columns); $q = $this->articleQuery($user, $context, $columns);
$q->setJoin("left join arsse_enclosures on arsse_enclosures.article is arsse_articles.id"); $q->setJoin("left join arsse_enclosures on arsse_enclosures.article is arsse_articles.id");

View file

@ -85,6 +85,8 @@ return [
'Exception.JKingWeb/Arsse/Exception.uncoded' => 'The specified exception symbol {0} has no code specified in AbstractException.php', 'Exception.JKingWeb/Arsse/Exception.uncoded' => 'The specified exception symbol {0} has no code specified in AbstractException.php',
// this should not usually be encountered // this should not usually be encountered
'Exception.JKingWeb/Arsse/Exception.unknown' => 'An unknown error has occurred', '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, 'Exception.JKingWeb/Arsse/ExceptionType.strictFailure' => 'Supplied value could not be normalized to {0, select,
1 {null} 1 {null}
2 {boolean} 2 {boolean}
@ -142,7 +144,6 @@ return [
'Exception.JKingWeb/Arsse/Db/Exception.savepointInvalid' => 'Tried to {action} invalid savepoint {index}', '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.savepointStale' => 'Tried to {action} stale savepoint {index}',
'Exception.JKingWeb/Arsse/Db/Exception.resultReused' => 'Result set already iterated', '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.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.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}', 'Exception.JKingWeb/Arsse/Db/ExceptionInput.tooLong' => 'Field "{field}" of action "{action}" has a maximum length of {max}',

View file

@ -474,7 +474,7 @@ trait SeriesArticle {
$this->assertEquals($columns, $test, "Fields do not match expectation for verbosity $constant"); $this->assertEquals($columns, $test, "Fields do not match expectation for verbosity $constant");
} }
// check that an unknown fieldset produces an exception // 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); Arsse::$db->articleList($this->user, (new Context)->article(101), \PHP_INT_MAX);
} }