Show
Ignore:
Timestamp:
01/21/2008 10:33:19 AM (10 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/Payment.php

    r1766 r1772  
    7878                $this->config = array_merge($this->config, Config::item('payment.'.$this->config['driver'])); 
    7979 
    80                 // Set driver name 
    81                 $driver = 'Payment_'.ucfirst($this->config['driver']).'_Driver'; 
     80                try 
     81                { 
     82                        // Set driver name 
     83                        $driver = 'Payment_'.ucfirst(strtolower($this->config['driver'])).'_Driver'; 
    8284 
    83                 // Manually call auto-loading, for proper exception handling 
    84                 Kohana::auto_load($driver); 
     85                        // Manually autoload so that exceptions can be caught 
     86                        Kohana::auto_load($driver); 
     87                } 
     88                catch (Kohana_Exception $e) 
     89                { 
     90                        throw new Kohana_Exception('payment.driver_not_supported', $this->config['driver']); 
     91                } 
    8592 
    8693                // Initialize the driver