PATH:
home
/
lab2454c
/
caimegroup.com
/
wp-content
/
plugins
/
mailpoet
/
lib
/
API
/
JSON
<?php declare(strict_types = 1); namespace MailPoet\API\JSON; if (!defined('ABSPATH')) exit; use MailPoet\Exception; use MailPoet\HttpAwareException; class ErrorHandler { /** @var string[] */ private $defaultErrors; public function __construct() { $this->defaultErrors = [ Error::UNKNOWN => __('An unknown error occurred.', 'mailpoet'), ]; } public function convertToResponse(\Throwable $e): ErrorResponse { if ($e instanceof Exception) { $errors = $e->getErrors() ?: $this->defaultErrors; $statusCode = $e instanceof HttpAwareException ? $e->getHttpStatusCode() : Response::STATUS_UNKNOWN; return new ErrorResponse($errors, [], $statusCode); } return new ErrorResponse($this->defaultErrors, [], Response::STATUS_UNKNOWN); } }
[-] index.php
[edit]
[-] ErrorResponse.php
[edit]
[+]
..
[-] SuccessResponse.php
[edit]
[+]
v1
[-] ErrorHandler.php
[edit]
[+]
ResponseBuilders
[-] Endpoint.php
[edit]
[-] API.php
[edit]
[-] Response.php
[edit]
[-] Error.php
[edit]