Catch duplicate index exception when creating and updating a document

This commit is contained in:
kodumbeats
2021-08-24 09:53:15 -04:00
parent abc6ceb941
commit 758f8e8eb2
+3 -1
View File
@@ -1307,6 +1307,9 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId')
catch (AuthorizationException $exception) {
throw new Exception('Unauthorized permissions', 401);
}
catch (DuplicateException $exception) {
throw new Exception($exception->getMessage(), 400);
}
catch (StructureException $exception) {
throw new Exception('Bad structure. '.$exception->getMessage(), 400);
}
@@ -1369,4 +1372,3 @@ App::delete('/v1/database/collections/:collectionId/documents/:documentId')
;
$response->noContent();
});