|
18 | 18 | use Utopia\Database\Exception\Restricted as RestrictedException; |
19 | 19 | use Utopia\Database\Exception\Structure as StructureException; |
20 | 20 | use Utopia\Database\Exception\Timeout as TimeoutException; |
| 21 | +use Utopia\Database\Exception\Type as TypeException; |
21 | 22 | use Utopia\Database\Helpers\ID; |
22 | 23 | use Utopia\Database\Helpers\Permission; |
23 | 24 | use Utopia\Database\Helpers\Role; |
@@ -5143,11 +5144,11 @@ public function increaseDocumentAttribute(string $collection, string $id, string |
5143 | 5144 | */ |
5144 | 5145 | $attr = \end($attr); |
5145 | 5146 | if (!in_array($attr->getAttribute('type'), $whiteList)) { |
5146 | | - throw new DatabaseException('Attribute type must be one of: ' . implode(',', $whiteList)); |
| 5147 | + throw new TypeException('Attribute type must be one of: ' . implode(',', $whiteList)); |
5147 | 5148 | } |
5148 | 5149 |
|
5149 | 5150 | if ($max && ($document->getAttribute($attribute) + $value > $max)) { |
5150 | | - throw new DatabaseException('Attribute value exceeds maximum limit: ' . $max); |
| 5151 | + throw new LimitException('Attribute value exceeds maximum limit: ' . $max); |
5151 | 5152 | } |
5152 | 5153 |
|
5153 | 5154 | $time = DateTime::now(); |
@@ -5234,11 +5235,11 @@ public function decreaseDocumentAttribute(string $collection, string $id, string |
5234 | 5235 | */ |
5235 | 5236 | $attr = \end($attr); |
5236 | 5237 | if (!in_array($attr->getAttribute('type'), $whiteList)) { |
5237 | | - throw new DatabaseException('Attribute type must be one of: ' . implode(',', $whiteList)); |
| 5238 | + throw new TypeException('Attribute type must be one of: ' . \implode(',', $whiteList)); |
5238 | 5239 | } |
5239 | 5240 |
|
5240 | 5241 | if ($min && ($document->getAttribute($attribute) - $value < $min)) { |
5241 | | - throw new DatabaseException('Attribute value Exceeds minimum limit ' . $min); |
| 5242 | + throw new LimitException('Attribute value exceeds minimum limit: ' . $min); |
5242 | 5243 | } |
5243 | 5244 |
|
5244 | 5245 | $time = DateTime::now(); |
|
0 commit comments