1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

feat: use general server errors in database API

This commit is contained in:
Christy Jacob 2022-02-07 00:49:21 +04:00
parent c1aed2b64b
commit 8189dba42c
3 changed files with 1 additions and 7 deletions

View file

@ -407,11 +407,6 @@ return [
'description' => 'The maximum number of collections has been reached.',
'statusCode' => 400,
],
Exception::COLLECTION_DELETION_FAILED => [
'name' => Exception::COLLECTION_DELETION_FAILED,
'description' => 'Failed to delete the collection from the database.',
'statusCode' => 500,
],
/** Documents */
Exception::DOCUMENT_NOT_FOUND => [

View file

@ -673,7 +673,7 @@ App::delete('/v1/database/collections/:collectionId')
}
if (!$dbForProject->deleteDocument('collections', $collectionId)) {
throw new Exception('Failed to remove collection from DB', 500, Exception::COLLECTION_DELETION_FAILED);
throw new Exception('Failed to remove collection from DB', 500, Exception::GENERAL_SERVER_ERROR);
}
$dbForProject->deleteCachedCollection('collection_' . $collectionId);

View file

@ -96,7 +96,6 @@ class Exception extends \Exception
const COLLECTION_NOT_FOUND = 'collection_not_found';
const COLLECTION_ALREADY_EXISTS = 'collection_already_exists';
const COLLECTION_LIMIT_EXCEEDED = 'collection_limit_exceeded';
const COLLECTION_DELETION_FAILED = 'collection_deletion_failed';
/** Documents */
const DOCUMENT_NOT_FOUND = 'document_not_found';