当前位置: 首页>>代码示例>>PHP>>正文


PHP bootstrap_renderer::early_error方法代码示例

本文整理汇总了PHP中bootstrap_renderer::early_error方法的典型用法代码示例。如果您正苦于以下问题:PHP bootstrap_renderer::early_error方法的具体用法?PHP bootstrap_renderer::early_error怎么用?PHP bootstrap_renderer::early_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bootstrap_renderer的用法示例。


在下文中一共展示了bootstrap_renderer::early_error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: default_exception_handler

/**
 * Default exception handler, uncaught exceptions are equivalent to error() in 1.9 and earlier
 *
 * @param Exception $ex
 * @return void -does not return. Terminates execution!
 */
function default_exception_handler($ex)
{
    global $CFG, $DB, $OUTPUT, $USER, $FULLME, $SESSION, $PAGE;
    // detect active db transactions, rollback and log as error
    abort_all_db_transactions();
    if ($ex instanceof required_capability_exception && !CLI_SCRIPT && !AJAX_SCRIPT && !empty($CFG->autologinguests) && !empty($USER->autologinguest)) {
        $SESSION->wantsurl = qualified_me();
        redirect(get_login_url());
    }
    $info = get_exception_info($ex);
    if (debugging('', DEBUG_MINIMAL)) {
        $logerrmsg = "Default exception handler: " . $info->message . ' Debug: ' . $info->debuginfo . "\n" . format_backtrace($info->backtrace, true);
        error_log($logerrmsg);
    }
    if (is_early_init($info->backtrace)) {
        echo bootstrap_renderer::early_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo, $info->errorcode);
    } else {
        try {
            if ($DB) {
                // If you enable db debugging and exception is thrown, the print footer prints a lot of rubbish
                $DB->set_debug(0);
            }
            echo $OUTPUT->fatal_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo);
        } catch (Exception $out_ex) {
            // default exception handler MUST not throw any exceptions!!
            // the problem here is we do not know if page already started or not, we only know that somebody messed up in outputlib or theme
            // so we just print at least something instead of "Exception thrown without a stack frame in Unknown on line 0":-(
            if (CLI_SCRIPT or AJAX_SCRIPT) {
                // just ignore the error and send something back using the safest method
                echo bootstrap_renderer::early_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo, $info->errorcode);
            } else {
                echo bootstrap_renderer::early_error_content($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo);
                $outinfo = get_exception_info($out_ex);
                echo bootstrap_renderer::early_error_content($outinfo->message, $outinfo->moreinfourl, $outinfo->link, $outinfo->backtrace, $outinfo->debuginfo);
            }
        }
    }
    exit(1);
    // General error code
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:46,代码来源:setuplib.php

示例2: print_error

/**
 * Abort execution, displaying an error message.
 *
 * @param string $errorcode The name of the language string containing the error message.
 *      Normally this should be in the error.php lang file.
 * @param string $module The language file to get the error message from.
 * @param string $link The url where the user will be prompted to continue.
 *      If no url is provided the user will be directed to the site index page.
 * @param object $a Extra words and phrases that might be required in the error string
 * @return void terminates script, does not return!
 */
function print_error($errorcode, $module = 'error', $link = '', $a = null)
{
    global $OUTPUT, $UNITTEST;
    // Errors in unit test become exceptions, so you can unit test code that might call print_error().
    if (!empty($UNITTEST->running)) {
        throw new moodle_exception($errorcode, $module, $link, $a);
    } else {
        // It is really bad if library code calls print_error when output buffering
        // is on.
        while (ob_get_level() > 0) {
            ob_end_clean();
        }
    }
    list($message, $moreinfourl, $link) = prepare_error_message($errorcode, $module, $link, $a);
    if (is_stacktrace_during_output_init(debug_backtrace())) {
        echo bootstrap_renderer::early_error($message, $moreinfourl, $link, debug_backtrace());
    } else {
        echo $OUTPUT->fatal_error($message, $moreinfourl, $link, debug_backtrace());
    }
    exit(1);
    // General error code
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:33,代码来源:setuplib.php


注:本文中的bootstrap_renderer::early_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。