message는 이 클래스를 상속받는 클래스를 정의할 때 $message 필드에 지정해야 한다
public __construct ( array $args = [], integer $code, Exception $previous = null ) | ||
$args | array | message 변환시 사용될 변수 목록 |
$code | integer | The Exception code. |
$previous | Exception | The previous exception used for the exception chaining. Since 5.3.0 |
/** * HttpXpressengineException constructor. * * @param array $args arguments array * @param int $statusCode exception status code * @param \Exception|null $previous exception * @param array $headers header * @param int $code code */ public function __construct($args = [], $statusCode = null, \Exception $previous = null, array $headers = [], $code = 0) { if ($statusCode !== null) { $this->statusCode = $statusCode; } $this->headers = $headers; parent::__construct($args, $code, $previous); }
/** * 생성자에서는 message 대신 message를 생성시 필요한 argument 목록을 입력받는다. * Message 는 \Xpressengine\Translation\Translator 로 변환되어 처리된다. * * Message 변환은 \App\Exceptions\Handler 에 서 처리된다. * * @param array $args message 변환 시 사용될 argument 목록 * @param int $code The Exception code. * @param Exception $previous The previous exception used for the exception chaining. Since 5.3.0 */ public function __construct(array $args = [], $code = 0, Exception $previous = null) { $this->args = $args; $this->message .= ' for ' . $args['id']; parent::__construct($args, $code, $previous); }