mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-23 09:02:41 +00:00
e74a3ae3cb
- Specifying a non-integer parent no longer silently casts to 0 or 1 - Specifying a folder ID of 0 now always converts to null automatically - Performing both a rename and move to root in the same operation no longer results in potential duplicates - Calling folderSetProperties with an empty data array no peforms an update; it now returns false before the update call - Modification timestamps are now actually updated when a folder is modified - Constraint violation exceptions triggered by code (rather than the database) now print a message - Renaming a folder or subscription to a non-string value (e.g. an array) throws an exception rather than silently casting - Added tests to better cover all the above - Centralized the normalization of integers and title strings into a new ValueInfo static class
22 lines
830 B
PHP
22 lines
830 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace JKingWeb\Arsse\Db\SQLite3;
|
|
|
|
use JKingWeb\Arsse\Db\Exception;
|
|
use JKingWeb\Arsse\Db\ExceptionInput;
|
|
use JKingWeb\Arsse\Db\ExceptionTimeout;
|
|
|
|
trait ExceptionBuilder {
|
|
public function exceptionBuild() {
|
|
switch ($this->db->lastErrorCode()) {
|
|
case self::SQLITE_BUSY:
|
|
return [ExceptionTimeout::class, 'general', $this->db->lastErrorMsg()];
|
|
case self::SQLITE_CONSTRAINT:
|
|
return [ExceptionInput::class, 'engineConstraintViolation', $this->db->lastErrorMsg()];
|
|
case self::SQLITE_MISMATCH:
|
|
return [ExceptionInput::class, 'engineTypeViolation', $this->db->lastErrorMsg()];
|
|
default:
|
|
return [Exception::class, 'engineErrorGeneral', $this->db->lastErrorMsg()];
|
|
}
|
|
}
|
|
}
|