We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a047293 + 0214201 commit 50e897aCopy full SHA for 50e897a
1 file changed
lib/public/AppFramework/Db/QBMapper.php
@@ -30,7 +30,7 @@
30
31
namespace OCP\AppFramework\Db;
32
33
-use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
+use OCP\DB\Exception;
34
use OCP\DB\QueryBuilder\IQueryBuilder;
35
use OCP\IDBConnection;
36
@@ -157,8 +157,11 @@ public function insert(Entity $entity): Entity {
157
public function insertOrUpdate(Entity $entity): Entity {
158
try {
159
return $this->insert($entity);
160
- } catch (UniqueConstraintViolationException $ex) {
161
- return $this->update($entity);
+ } catch (Exception $ex) {
+ if ($ex->getReason() === Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
162
+ return $this->update($entity);
163
+ }
164
+ throw $ex;
165
}
166
167
0 commit comments