title: Yii2 Custom http exceptions views
body: <p>In the application login I have the following code that throw <code>...HttpException</code> on logging errors:</p>
  
  <pre><code>// common/models/LoginForm.php which is called from the backend SiteController actionLogin method as $model = new LoginForm();
  
  public function loginAdmin()
      {
        //die($this-&gt;getUser()-&gt;getRoleValue()."hhh");
        if ($this-&gt;getUser()-&gt;getRoleValue() &gt;= ValueHelpers::getRoleValue('Admin') &amp;&amp; $this-&gt;getUser()-&gt;getStatusValue() == ValueHelpers::getStatusValue('Active')){
          if ($this-&gt;validate()){
            return \Yii::$app-&gt;user-&gt;login($this-&gt;getUser(), $this-&gt;rememberMe ? 3600*24*30:0);         
          }
          else{
            throw new \yii\web\NotFoundHttpException('Incorrect Password or Username.');
  
          }       
        }
        else{
          throw new \yii\web\ForbiddenHttpException('Insufficient privileges to access this area.');
        }
      }
  </code></pre>
  
  <p>It is working fine, but I want to customize the page the rendered with each of <code>NotFoundHttpException</code> and <code>ForbiddenHttpException</code>. I tried to search the <a href="http://www.yiiframework.com/doc-2.0/yii-web-forbiddenhttpexception.html#__construct()-detail" rel="nofollow">Yii2 api</a> to find any parameters that may define view in the construct of the object but I could not find that. So, is there any way to custom the view of the exception?</p>