feat: exceptions on more files

This commit is contained in:
Christy Jacob
2022-08-14 12:26:12 +05:30
parent 662bfe0ab8
commit a5bc0a61ca
10 changed files with 37 additions and 151 deletions
+3 -3
View File
@@ -84,11 +84,11 @@ function createAttribute(string $databaseId, string $collectionId, Document $att
// Must throw here since dbForProject->createAttribute is performed by db worker
if ($required && $default) {
throw new Exception(Exception::ATTRIBUTE_DEFAULT_UNSUPPORTED);
throw new Exception(Exception::ATTRIBUTE_DEFAULT_UNSUPPORTED, 'Cannot set default value for required attribute');
}
if ($array && $default) {
throw new Exception(Exception::ATTRIBUTE_DEFAULT_UNSUPPORTED);
throw new Exception(Exception::ATTRIBUTE_DEFAULT_UNSUPPORTED, 'Cannot set default value for array attribute');
}
try {
@@ -184,7 +184,7 @@ App::post('/v1/databases')
$collections = Config::getParam('collections', [])['collections'] ?? [];
if (empty($collections)) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Collections collection is not configured.');
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'The "collections" collection is not configured.');
}
$attributes = [];