Skip to content

Commit c1122f9

Browse files
replaced Database exception with the Order exception where cursor null is getting checked
1 parent 7f39605 commit c1122f9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Database/Adapter/MariaDB.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Utopia\Database\Exception as DatabaseException;
1212
use Utopia\Database\Exception\Duplicate as DuplicateException;
1313
use Utopia\Database\Exception\NotFound as NotFoundException;
14+
use Utopia\Database\Exception\Order;
1415
use Utopia\Database\Exception\Timeout as TimeoutException;
1516
use Utopia\Database\Exception\Truncate as TruncateException;
1617
use Utopia\Database\Helpers\ID;
@@ -1716,7 +1717,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
17161717
}
17171718

17181719
if (\is_null($cursor[$originalAttribute] ?? null)) {
1719-
throw new DatabaseException("Order attribute '{$originalAttribute}' is empty");
1720+
throw new Order("Order attribute '{$originalAttribute}' is empty", 400, null, $originalAttribute);
17201721
}
17211722

17221723
$binds[':cursor'] = $cursor[$originalAttribute];

src/Database/Adapter/Postgres.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Utopia\Database\Document;
1111
use Utopia\Database\Exception as DatabaseException;
1212
use Utopia\Database\Exception\Duplicate as DuplicateException;
13+
use Utopia\Database\Exception\Order;
1314
use Utopia\Database\Exception\Timeout as TimeoutException;
1415
use Utopia\Database\Exception\Transaction as TransactionException;
1516
use Utopia\Database\Exception\Truncate as TruncateException;
@@ -1549,7 +1550,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
15491550
}
15501551

15511552
if (\is_null($cursor[$originalAttribute] ?? null)) {
1552-
throw new DatabaseException("Order attribute '{$originalAttribute}' is empty");
1553+
throw new Order("Order attribute '{$originalAttribute}' is empty", 400, null, $originalAttribute);
15531554
}
15541555

15551556
$binds[':cursor'] = $cursor[$originalAttribute];

0 commit comments

Comments
 (0)