Ends custom error handling.

@param bool $use
The return value of Serializer::errorStart().
501112
protected function errorStop($use) {
    foreach (libxml_get_errors() as $error) {
      switch ($error->level) {
        case LIBXML_ERR_WARNING:
        case LIBXML_ERR_ERROR:
          $level = LogLevel::WARNING;
          break;

        case LIBXML_ERR_FATAL:
          $level = LogLevel::ERROR;
          break;

        default:
          $level = LogLevel::INFO;
      }

      $this->log($level, '%error on line %num. Error code: %code.', array(
        '%error' => trim($error->message),
        '%num' => $error->line,
        '%code' => $error->code,
      ));
    }
    libxml_clear_errors();
    libxml_use_internal_errors($use);
  }
557577
public function end() {
		if ($this->is_end) {
			return;
		}
		$this->is_end = true;
		if ($this->sw_response) {
			if (($this->tpl_auto === null && self::$tpl_auto_config) || $this->tpl_auto) {
				$this->display();
			}
			$this->sw_response->end();
			$this->sw_response = null;
		}
		$this->tpl_engine_obj = null;
	}
100689
private void abort(Error error) {
    try {
      if (mContext == null || mContext.getError() != null || mContext.isDoneUnsafe()) {
        // Note, we may reach here via events due to network errors bubbling up before
        // mContext is initialized, or stream error after the request is finished.
        return;
      }
      mContext.setError(error);
      cleanupRequest(mContext);
      replyError();
    } catch (Exception e) {
      LOG.warn("Failed to cleanup states with error {}.", e.getMessage());
    }
  }
260507
final public static function shutdownFunction()
	{
		$last_error = error_get_last();

		if (isset($last_error) && ($last_error['type'] &
		(E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR))) {
			self::errorHandler($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']);
		}
	}
540239
public function halt($errors = null)
    {
        // Display errors
        if ($errors) {
            $this->explainer->error($errors);
        }

        $this->fireEvent('halt');
        $this->halted = true;

        if ($this->event) {
            $this->getEvent()->stopPropagation();
        }

        return false;
    }
718310
public static function errorOut($s) {
        // Always output errors
        $oldQuiet = self::getQuiet();
        self::setQuiet(false);

        self::lineOut($s, self::RED);
        self::setQuiet($oldQuiet);
    }
1344355
protected function checkError()
	{
		if (isset($_GET[$this->errorParam])) {
			$error_code = $_GET[$this->errorParam];
			if ($error_code === $this->errorAccessDeniedCode) {
				// access_denied error (user canceled)
				$this->cancel();
			} else {
				$error = $error_code;
				if (isset($_GET[$this->errorDescriptionParam])) {
					$error = $_GET[$this->errorDescriptionParam] . ' (' . $error . ')';
				}
				throw new ErrorException($error);
			}
			return false;
		}

		return true;
	}
901536
function onError(error) {
    me.terminated = true;
    if (me.terminating && me.terminationHandler) {
      me.terminationHandler(me);
    }
    me.terminating = false;

    for (var id in me.processing) {
      if (me.processing[id] !== undefined) {
        me.processing[id].resolver.reject(error);
      }
    }
    me.processing = Object.create(null);
  }
240537
protected function fail($error = '')
    {
        $this->isFinished = true;
        $this->isSuccess = false;
        $this->error = $error;
    }
1184207
public function autodetect_on_failure($use_default = true)
    {
        if ($use_default) {
            return isset($this->autodetect_on_failure) ? $this->autodetect_on_failure : $this->default_autodetect_on_failure;
        }

        return $this->autodetect_on_failure;
    }
344058
public function enableFatalErrorHandling() {
        if ($this->isFatalErrorHandlingEnabled()) {
            return;
        }

        register_shutdown_function(function () {
            return $this->errorConverter
                ->extractFatalErrorAndCallHandler($this);
        });
        $this->isFatalErrorHandlingEnabled = true;
    }
684110
public function end($exitCode = 0, $exit = true)
    {
        if ($this->hasEventHandler('endRequest')) {
            $this->onEndRequest(new Event($this));
        }
        if ($exit) {
            exit($exitCode);
        }
    }
666357
protected function query_end($result) {
        // reset original debug level
        error_reporting($this->last_error_reporting);
        try {
            parent::query_end($result);
            if ($this->savepointpresent and $this->last_type != SQL_QUERY_AUX and $this->last_type != SQL_QUERY_SELECT) {
                $res = @pg_query($this->pgsql, "RELEASE SAVEPOINT moodle_pg_savepoint; SAVEPOINT moodle_pg_savepoint");
                if ($res) {
                    pg_free_result($res);
                }
            }
        } catch (Exception $e) {
            if ($this->savepointpresent) {
                $res = @pg_query($this->pgsql, "ROLLBACK TO SAVEPOINT moodle_pg_savepoint; SAVEPOINT moodle_pg_savepoint");
                if ($res) {
                    pg_free_result($res);
                }
            }
            throw $e;
        }
    }
110776
public function isFinalized($error = false)
    {
        if ($this->finalized && $error) {
            $this->triggerError($error, E_USER_ERROR);
        }
        return $this->finalized;
    }
32061
function (error) {
        if (!this.started) {
            return;
        }

        var errorHandlers = this.errorHandlers,
            length = errorHandlers.length,
            errorHandler,
            errorHandled = false,
            errorString,
            i;

        //Exit handling
        if (error instanceof SystemExit) {
            this._exit(error.code);
            return;
        }

        try {
            for (i = 0; i < length; i += 1) {
                errorHandler = errorHandlers[i];
                errorHandled = !!errorHandler(error);

                if (errorHandled) {
                    return;
                }
            }
        } catch (e) {
            this._printError(e);
            this._exit(1);
        }

        //Default error handling
        errorString = '' + (error.stack || error);
        this._printError(errorString);
        this._exit(1);
    }
1255592
public function checkEndsWith($value, $end)
    {
        if (!Type::isStringable($value)) {
            return false;
        }

        return Helper::endsWith("$value", $end);
    }
751612
public function setErrorHandler()
    {
        set_error_handler(function ($errno, $errstr, $errfile, $errline ) {
            throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
        });
    }