title: I can not catch exception in Yii framework
body: <p>I am using Yii framework and have written code below. When there is no entry for a specific id it gives  <code>Error: Call to a member function delete() on a non-object</code> which is a <code>yii\base\ErrorException</code> indicated in debug mode. The problem is that I am not able to catch this exception despite my inclusion of <code>yii\base\ErrorException</code> and specify it catch block. What is the problem here?</p>
  
  <pre><code>            use yii\base\ErrorException;
  
              try {
                  $model = BranchUser::findOne($_GET['id']);
                  $model-&gt;delete();
                  return $this-&gt;redirect(['index']);
              } catch (ErrorException $e) {
                  return $this-&gt;redirect(['site/error']);
                  // Error, rollback transaction
                  throw $e;
                  // print_r($model-&gt;getErrors());
  
              }
  </code></pre>