Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Exception.php
Go to the documentation of this file.
1 <?php
9 
10 use Magento\Framework\Exception\ErrorMessage;
13 
21 {
25  const HTTP_BAD_REQUEST = 400;
26 
27  const HTTP_UNAUTHORIZED = 401;
28 
29  const HTTP_FORBIDDEN = 403;
30 
31  const HTTP_NOT_FOUND = 404;
32 
34 
35  const HTTP_NOT_ACCEPTABLE = 406;
36 
37  const HTTP_INTERNAL_ERROR = 500;
38 
44  const FAULT_CODE_SENDER = 'Sender';
45  const FAULT_CODE_RECEIVER = 'Receiver';
46 
52  protected $_details;
53 
59  protected $_httpCode;
60 
66  protected $_name;
67 
73  protected $_stackTrace;
74 
80  protected $_errors;
81 
95  public function __construct(
97  $code = 0,
98  $httpCode = self::HTTP_BAD_REQUEST,
99  array $details = [],
100  $name = '',
101  $errors = null,
102  $stackTrace = null
103  ) {
105  if ($httpCode < 400 || $httpCode > 599) {
106  throw new \InvalidArgumentException(sprintf('The specified HTTP code "%d" is invalid.', $httpCode));
107  }
108  parent::__construct($phrase, null, $code);
109  $this->code = $code;
110  $this->_httpCode = $httpCode;
111  $this->_details = $details;
112  $this->_name = $name;
113  $this->_errors = $errors;
114  $this->_stackTrace = $stackTrace;
115  }
116 
122  public function getHttpCode()
123  {
124  return $this->_httpCode;
125  }
126 
132  public function getOriginator()
133  {
135  }
136 
142  public function getDetails()
143  {
144  return $this->_details;
145  }
146 
152  public function getName()
153  {
154  return $this->_name;
155  }
156 
162  public function getErrors()
163  {
164  return $this->_errors;
165  }
166 
172  public function getStackTrace()
173  {
174  return $this->_stackTrace;
175  }
176 }
__construct(Phrase $phrase, $code=0, $httpCode=self::HTTP_BAD_REQUEST, array $details=[], $name='', $errors=null, $stackTrace=null)
Definition: Exception.php:95
$details
Definition: vault.phtml:10
$errors
Definition: overview.phtml:9
$code
Definition: info.phtml:12
if(!isset($_GET['name'])) $name
Definition: log.php:14