File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace DeliciousBrains \SpinupWp \Endpoints ;
4
4
5
+ use DeliciousBrains \SpinupWp \Exceptions \AccessDeniedException ;
5
6
use DeliciousBrains \SpinupWp \Exceptions \NotFoundException ;
6
7
use DeliciousBrains \SpinupWp \Exceptions \RateLimitException ;
7
8
use DeliciousBrains \SpinupWp \Exceptions \TimeoutException ;
@@ -47,6 +48,10 @@ protected function handleRequestError(ResponseInterface $response): void
47
48
throw new UnauthorizedException ();
48
49
}
49
50
51
+ if ($ response ->getStatusCode () === 403 ) {
52
+ throw new AccessDeniedException ();
53
+ }
54
+
50
55
if ($ response ->getStatusCode () === 404 ) {
51
56
throw new NotFoundException ();
52
57
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace DeliciousBrains \SpinupWp \Exceptions ;
4
+
5
+ use Exception ;
6
+
7
+ class AccessDeniedException extends Exception
8
+ {
9
+ public function __construct ()
10
+ {
11
+ parent ::__construct ('Your API token does not have permission to that resource. ' , 403 );
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments