Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Database/Adapter/MariaDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Utopia\Database\Exception as DatabaseException;
use Utopia\Database\Exception\Duplicate as DuplicateException;
use Utopia\Database\Exception\NotFound as NotFoundException;
use Utopia\Database\Exception\Order as OrderException;
use Utopia\Database\Exception\Timeout as TimeoutException;
use Utopia\Database\Exception\Truncate as TruncateException;
use Utopia\Database\Helpers\ID;
Expand Down Expand Up @@ -1716,7 +1717,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
}

if (\is_null($cursor[$originalAttribute] ?? null)) {
throw new DatabaseException("Order attribute '{$originalAttribute}' is empty");
throw new OrderException("Order attribute '{$originalAttribute}' is empty", 0, null, $originalAttribute);
}

$binds[':cursor'] = $cursor[$originalAttribute];
Expand Down
3 changes: 2 additions & 1 deletion src/Database/Adapter/Postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Utopia\Database\Document;
use Utopia\Database\Exception as DatabaseException;
use Utopia\Database\Exception\Duplicate as DuplicateException;
use Utopia\Database\Exception\Order as OrderException;
use Utopia\Database\Exception\Timeout as TimeoutException;
use Utopia\Database\Exception\Transaction as TransactionException;
use Utopia\Database\Exception\Truncate as TruncateException;
Expand Down Expand Up @@ -1549,7 +1550,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
}

if (\is_null($cursor[$originalAttribute] ?? null)) {
throw new DatabaseException("Order attribute '{$originalAttribute}' is empty");
throw new OrderException("Order attribute '{$originalAttribute}' is empty", 0, null, $originalAttribute);
}

$binds[':cursor'] = $cursor[$originalAttribute];
Expand Down
20 changes: 20 additions & 0 deletions src/Database/Exception/Order.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Utopia\Database\Exception;

use Throwable;
use Utopia\Database\Exception;

class Order extends Exception
{
protected ?string $attribute;
public function __construct(string $message, int|string $code = 0, ?Throwable $previous = null, ?string $attribute = null)
{
$this->attribute = $attribute;
parent::__construct($message, $code, $previous);
}
public function getAttribute(): ?string
{
return $this->attribute;
}
}