Ignore UniqueConstraintViolationException when creating new items.
This commit is contained in:
parent
7d542eb3d0
commit
27abab0dee
1 changed files with 6 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Pdfdraw\Controller;
|
namespace OCA\Pdfdraw\Controller;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||||
use \Firebase\JWT\JWT;
|
use \Firebase\JWT\JWT;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
use OCP\AppFramework\Http\DataDownloadResponse;
|
use OCP\AppFramework\Http\DataDownloadResponse;
|
||||||
|
|
@ -174,7 +175,11 @@ class ApiController extends OCSController {
|
||||||
'data' => $query->createNamedParameter($data),
|
'data' => $query->createNamedParameter($data),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$query->execute();
|
try {
|
||||||
|
$query->execute();
|
||||||
|
} catch (UniqueConstraintViolationException $e) {
|
||||||
|
// Ignore, another request created the item.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new DataResponse([]);
|
return new DataResponse([]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue