[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.149.240.196: ~ $
<?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 convertToResponse(\Throwable $e): ErrorResponse {
    $this->defaultErrors[Error::UNKNOWN] = __('An unknown error occurred.', 'mailpoet');

    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 0755
v1 Folder 0755
API.php File 10.11 KB 0644
Endpoint.php File 1.61 KB 0644
Error.php File 445 B 0644
ErrorHandler.php File 740 B 0644
ErrorResponse.php File 921 B 0644
Response.php File 1.31 KB 0644
SuccessResponse.php File 519 B 0644
index.php File 6 B 0644