Skip to content

Response exception should hold the response #11

@nohponex

Description

@nohponex
/**
 * @author Xenofon Spafaridis <nohponex@gmail.com>
 * @since 0.0.0
 */
class ResponseException extends \Exception
{
    /**
     * @var Response
     */
    private $response;

    /**
     * @var Errors
     */
    private $errors;

    /**
     * @param Errors $errors
     */
    public function __construct(Response $response)
    {
        $this->errors = (new Errors($response->getResponse()));
        $this->response = $response;

        parent::__construct('Response exception');
    }

    /**
     * @return Error[]
     */
    public function getErrors()
    {
        return $this->errors->getErrors();
    }

    /**
     * @return Response
     */
    public function getResponse(): Response
    {
        return $this->response;
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions