return previous value if database should throw exceptions

This commit is contained in:
Art4 2025-04-16 06:12:13 +00:00
parent e4a93fc9c7
commit 59ee2f34e7
2 changed files with 12 additions and 3 deletions

View file

@ -32,12 +32,12 @@ final class UserDeletedRepository
*/
public function insertByUsername(string $username): void
{
$this->database->throwExceptionsOnErrors(true);
$throw = $this->database->throwExceptionsOnErrors(true);
try {
$this->database->insert('userd', ['username' => $username]);
} finally {
$this->database->throwExceptionsOnErrors(false);
$this->database->throwExceptionsOnErrors($throw);
}
}