Skip to content

Commit bf9515d

Browse files
committed
feat: add no route exception
1 parent 85189df commit bf9515d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Exceptions/NoRouteException.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Storipress\WordPress\Exceptions;
6+
7+
class NoRouteException extends WordPressException
8+
{
9+
//
10+
}

src/Requests/Request.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Storipress\WordPress\Exceptions\CannotUpdateException;
1414
use Storipress\WordPress\Exceptions\DuplicateTermSlugException;
1515
use Storipress\WordPress\Exceptions\ForbiddenException;
16+
use Storipress\WordPress\Exceptions\NoRouteException;
1617
use Storipress\WordPress\Exceptions\NotFoundException;
1718
use Storipress\WordPress\Exceptions\TermExistsException;
1819
use Storipress\WordPress\Exceptions\UnauthorizedException;
@@ -122,6 +123,7 @@ protected function error(stdClass $payload, string $message, int $status): void
122123
'duplicate_term_slug' => new DuplicateTermSlugException($error, $status),
123124
'rest_cannot_create' => new CannotCreateException($error, $status),
124125
'rest_cannot_update' => new CannotUpdateException($error, $status),
126+
'rest_no_route' => new NoRouteException($error, $status),
125127
default => new UnknownException($error, $status),
126128
};
127129
}

0 commit comments

Comments
 (0)