Convert all errors to execeptions

This commit is contained in:
Timothy Warren 2012-04-10 09:38:57 -04:00
parent 4b5ba2a7dc
commit 9b3a242b04
4 changed files with 18 additions and 8 deletions

View File

@ -26,7 +26,7 @@ error_reporting(-1 & ~(E_STRICT));
// Set the stupid timezone so PHP shuts up.
date_default_timezone_set('GMT');
// Don't set an arbitary memory limit!
// Don't set an arbitrary memory limit!
ini_set('memory_limit', -1);
// Set the current directory as the base for included files
@ -75,6 +75,16 @@ if( ! class_exists('pdo'))
// --------------------------------------------------------------------------
// Convert Errors to Exceptions
// Do this after the two compatibility checks for cleaner output
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler", -1);
// --------------------------------------------------------------------------
/**
* Alias for require_once for array_map
*

View File

@ -30,14 +30,14 @@ class firebird extends DB_PDO {
*/
public function __construct($dbpath, $user='sysdba', $pass='masterkey')
{
$this->conn = @fbird_connect($dbpath, $user, $pass, 'utf-8');
$this->conn = fbird_connect($dbpath, $user, $pass, 'utf-8');
// Throw an exception to make this match other pdo classes
if ( ! is_resource($this->conn))
/*if ( ! is_resource($this->conn))
{
throw new PDOException(fbird_errmsg());
die();
}
}*/
$class = __CLASS__."_sql";
$this->sql = new $class;
@ -91,8 +91,8 @@ class firebird extends DB_PDO {
$this->count = 0;
$this->statement_link = (isset($this->trans))
? @fbird_query($this->trans, $sql)
: @fbird_query($this->conn, $sql);
? fbird_query($this->trans, $sql)
: fbird_query($this->conn, $sql);
// Throw the error as a exception
if ($this->statement_link === FALSE)
@ -115,7 +115,7 @@ class firebird extends DB_PDO {
*/
public function prepare($query, $options=NULL)
{
$this->statement_link = @fbird_prepare($this->conn, $query);
$this->statement_link = fbird_prepare($this->conn, $query);
// Throw the error as an exception
if ($this->statement_link === FALSE)

View File

@ -136,7 +136,7 @@ class Firebird_SQL extends DB_SQL {
*/
public function backup_structure()
{
// @todo Implement Backup function
// @todo Implement Backup structure function
return '';
}

Binary file not shown.