Show
Ignore:
Timestamp:
01/25/2008 12:46:30 PM (12 months ago)
Author:
Shadowhand
Message:

Changes to exception handling:

  • Disabling display_errors now shows a generic error message, without no stack trace
  • All error messages are now properly compressed via global configuration
  • New i18n messages added to core.php
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/core/Kohana.php

    r1781 r1810  
    473473                } 
    474474 
    475                 // Test if display_errors is off 
    476                 if (Config::item('core.display_errors') == FALSE) 
    477                         return; 
    478  
    479475                if ($PHP_ERROR) 
    480476                { 
     
    500496                } 
    501497 
    502                 if ($line != FALSE) 
    503                 { 
    504                         // Remove the first entry of debug_backtrace(), it is the exception_handler call 
    505                         $trace = $PHP_ERROR ? array_slice(debug_backtrace(), 1) : $exception->getTrace(); 
    506  
    507                         // Beautify backtrace 
    508                         $trace = self::backtrace($trace); 
    509                 } 
    510  
    511                 // Load the error 
    512                 include self::find_file('views', empty($template) ? 'kohana_error_page' : $template); 
     498                // Test if display_errors is on 
     499                if (Config::item('core.display_errors')) 
     500                { 
     501                        if ($line != FALSE) 
     502                        { 
     503                                // Remove the first entry of debug_backtrace(), it is the exception_handler call 
     504                                $trace = $PHP_ERROR ? array_slice(debug_backtrace(), 1) : $exception->getTrace(); 
     505 
     506                                // Beautify backtrace 
     507                                $trace = self::backtrace($trace); 
     508                        } 
     509 
     510                        // Load the error 
     511                        include self::find_file('views', empty($template) ? 'kohana_error_page' : $template); 
     512                } 
     513                else 
     514                { 
     515                        // Get the i18n messages 
     516                        $error = Kohana::lang('core.generic_error'); 
     517                        $message = sprintf(Kohana::lang('core.errors_disabled'), url::site(''), url::site(Router::$current_uri)); 
     518 
     519                        // Load the errors_disabled view 
     520                        include self::find_file('views', 'kohana_error_disabled'); 
     521                } 
    513522 
    514523                // Run the system.shutdown event