Show
Ignore:
Timestamp:
01/21/2008 10:33:19 AM (12 months ago)
Author:
Geert
Message:

Kohana::auto_load() now throws an exception if the needed file does not exist.

This fixes proper exception handling on all the driver based libraries: Archive, Cache, Database, Image, Payment and Session.
See for example: http://trac.kohanaphp.com/browser/trunk/system/libraries/Session.php?rev=1745#L63

Also changed code and lang files to be more consistent.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Database.php

    r1719 r1772  
    155155                { 
    156156                        // Set driver name 
    157                         $driver = 'Database_'.ucfirst($this->config['connection']['type']).'_Driver'; 
    158  
    159                         // Manually call auto-loading, for proper exception handling 
     157                        $driver = 'Database_'.ucfirst(strtolower($this->config['connection']['type'])).'_Driver'; 
     158 
     159                        // Manually autoload so that exceptions can be caught 
    160160                        Kohana::auto_load($driver); 
    161  
    162                         // Initialize the driver 
    163                         $this->driver = new $driver($this->config); 
    164161                } 
    165162                catch (Kohana_Exception $e) 
     
    167164                        throw new Kohana_Database_Exception('database.driver_not_supported', $this->config['connection']['type']); 
    168165                } 
     166 
     167                // Initialize the driver 
     168                $this->driver = new $driver($this->config); 
    169169 
    170170                // Validate the driver