public function handleError($errno, $errstr, $errfile, $errline)
  {
    if (error_reporting()===0)
    {
      // Error was suppressed with the @-operator. Don't throw an exception.
      return false;
    }

    $exception = new ErrorException($errstr, $errno, $errno, $errfile, $errline);

    // In case error appeared in __toString method we can't throw any exception.
    $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
    array_shift($trace);
    foreach ($trace as $frame)
    {
      if ($frame['function']==='__toString')
      {
        $this->handleException($exception);

        exit(1);
      }
    }

    throw $exception;
  }