Httpexception. How To Modify Content And Body Structure.

Hello! I’m trying to make HttpException more friendly and beautifully for the non englishmen.

This is my code:

  private function loadModel($id) {

    if ($id === NULL)

      throw new HttpException(404, 'Запись не найдена.');

The output:

<h1>Not Found (#404)</h1>

<div class="alert alert-danger">Запись не найдена.</div>

For example, I need something like this:

<h1 class="color-yellow">Страница отсутсвует</h1>

<p class="alert alert-danger">Запись не найдена.</p>

I’ve tried to find properties or methods in official documentation as in the HttpException and in the parent classes, but have found nothing.

How can I change the HttpException output?

You can set your own error handling action in config.

Thank you I’ve understood, but I can’t find the way how to modify error title. For example, instead of Not Found (#404) simply put Не найдено.

There’s a документация on that:

You can use ‘message’ property of exception class to get your Не найдено and put it in шаблон

Thank you. I think, it is actually what I need.

Дожили) на английском между собой пишемся)

В английской ветке принято по-английски писать. Для них кириллица - как для нас арабская вязь.

You are absolutely right)