Skip to content

Commit

Permalink
rename PaginatorException to InvalidPageException
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Jan 5, 2025
1 parent 576b1a8 commit f953f91
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
14 changes: 14 additions & 0 deletions src/Paginator/InvalidPageException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Paginator;

use LogicException;

/**
* Thrown when the page is invalid.
*/
class InvalidPageException extends LogicException
{
}
2 changes: 1 addition & 1 deletion src/Paginator/OffsetPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function withToken(?PageToken $token): static
} else {
$page = (int) $token->value;
if ($page < 1) {
throw new PaginatorException('Current page should be at least 1.');
throw new InvalidPageException('Current page should be at least 1.');
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Paginator/PageNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use function sprintf;

final class PageNotFoundException extends PaginatorException
final class PageNotFoundException extends InvalidPageException
{
public function __construct(int $page)
{
Expand Down
16 changes: 0 additions & 16 deletions src/Paginator/PaginatorException.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Paginator/PaginatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface PaginatorInterface extends ReadableDataInterface
*
* @param PageToken|null $token Page token. `Null` if current page is first.
*
* @throws PaginatorException If page token is incorrect.
* @throws InvalidPageException If page token is incorrect.
*
* @return static New instance.
*
Expand Down

0 comments on commit f953f91

Please sign in to comment.