mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-11 09:34:26 +02:00
Work with DatabaseException in UserDeletedRepository
This commit is contained in:
parent
2879db12dc
commit
e4a93fc9c7
5 changed files with 20 additions and 18 deletions
|
@ -28,14 +28,16 @@ final class UserDeletedRepository
|
|||
/**
|
||||
* Insert a deleted user by username.
|
||||
*
|
||||
* @throws \Exception If the username could not be inserted
|
||||
* @throws DatabaseException If the username could not be inserted
|
||||
*/
|
||||
public function insertByUsername(string $username): void
|
||||
{
|
||||
$result = $this->database->insert('userd', ['username' => $username]);
|
||||
$this->database->throwExceptionsOnErrors(true);
|
||||
|
||||
if ($result === false) {
|
||||
throw new Exception(sprintf('Error while inserting username `%s` as deleted user.', $username));
|
||||
try {
|
||||
$this->database->insert('userd', ['username' => $username]);
|
||||
} finally {
|
||||
$this->database->throwExceptionsOnErrors(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue