PluginProbe
WooCommerce / 11.1.0-beta.1
WooCommerce v11.1.0-beta.1
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / src / Api / UnauthorizedException.php
UnauthorizedException.php
33 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Automattic\WooCommerce\Api;
6
7 /**
8 * Thrown to deny access with a 401 Unauthorized status.
9 *
10 * Use when authentication is required but missing, or when an `authorize()`
11 * method needs to deny access without distinguishing further. For credentials
12 * that are present but rejected, prefer {@see InvalidTokenException}; for
13 * "authenticated but not allowed", prefer {@see ForbiddenException}.
14 *
15 * Wire shape: `extensions.code = 'UNAUTHORIZED'`, HTTP status 401.
16 */
17 class UnauthorizedException extends ApiException {
18 /**
19 * Constructor.
20 *
21 * @param string $message The error message.
22 * @param array $extensions Additional error metadata to surface in the GraphQL `extensions` object.
23 * @param ?\Throwable $previous The previous throwable for chaining.
24 */
25 public function __construct(
26 string $message = 'Authentication required.',
27 array $extensions = array(),
28 ?\Throwable $previous = null,
29 ) {
30 parent::__construct( $message, 'UNAUTHORIZED', $extensions, 401, $previous );
31 }
32 }
33