blob: 659c6d772161016bb32028b9d7f1e69b8259a30f [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Translation\Exception;
13
14use Symfony\Contracts\HttpClient\ResponseInterface;
15
16/**
17 * @author Fabien Potencier <fabien@symfony.com>
18 *
19 * @experimental in 5.3
20 */
21class ProviderException extends RuntimeException implements ProviderExceptionInterface
22{
23 private $response;
24 private $debug;
25
26 public function __construct(string $message, ResponseInterface $response, int $code = 0, \Exception $previous = null)
27 {
28 $this->response = $response;
29 $this->debug .= $response->getInfo('debug') ?? '';
30
31 parent::__construct($message, $code, $previous);
32 }
33
34 public function getResponse(): ResponseInterface
35 {
36 return $this->response;
37 }
38
39 public function getDebug(): string
40 {
41 return $this->debug;
42 }
43}