NaifyView\Exception\NaifyViewException クラス

extends RuntimeException
implements Stringable, Throwable

NaifyViewException — NaifyView2 の観測可能な例外

message だけでなく key / payload / source hint を持たせ、template error を人間が追える形にする。 parser / compiler / runtime の境界で共通の失敗表現として使う。

使用例

throw new NaifyViewException('template parse failed', payload: ['template' => $path]);

プロパティ

名前型説明
private $errorCode string machine-readable error code
private $messageKey string message catalog 向け key
private $payload array message interpolation payload

メソッド

メソッド説明
public override __construct(string $message, string $errorCode = naifyview.runtime_error, string $messageKey = naifyview.error.runtime_error, array $payload = '...', ?Throwable $previous): void インスタンスを初期化する
public getErrorCode(): string `getErrorCode()` の値を返す
public getMessageKey(): string `getMessageKey()` の値を返す
public getPayload(): array `getPayload()` の値を返す
public toObservationArray(): array `toObservationArray()` を実行する
public formatCatalogMessage(string $locale = ja): string `formatCatalogMessage()` を実行する

継承プロパティ

名前型説明継承元
protected $message mixed Exception
protected $code mixed Exception
protected $file string Exception
protected $line int Exception

継承メソッド

メソッド説明継承元
public getMessage(): string Exception
public getCode(): Exception
public getFile(): string Exception
public getLine(): int Exception
public getTrace(): array Exception
public getPrevious(): ?Throwable Exception
public getTraceAsString(): string Exception