protected function convertDatabaseException(\Exception $e)
	{
		if($e instanceof DatabaseException)
		{
			return $e;
		}
		
		// Check for PDO exception in order to determine FK violation:
		$cause = $e;
		
		if(!$cause instanceof \PDOException)
		{
			while(NULL !== ($cause = $cause->getPrevious()))
			{
				if($cause instanceof \PDOException)
				{
					break;
				}
			}
		}
		
		if($cause instanceof \PDOException)
		{
			switch($this->driverName)
			{
				case DB::DRIVER_MYSQL:
					return $this->convertMySqlException($cause, $e);
				case DB::DRIVER_POSTGRESQL:
					return $this->convertPostgresException($cause, $e);
				case DB::DRIVER_SQLITE:
					return $this->convertSqliteException($cause, $e);
			}
		}
		
		return new DatabaseException($e->getMessage(), 0, $e);
	}
protected function convertDatabaseException(\Exception $e)
	{
		if($e instanceof DatabaseException)
		{
			return $e;
		}
		
		// Check for PDO exception in order to determine FK violation:
		$cause = $e;
		
		if(!$cause instanceof \PDOException)
		{
			while(NULL !== ($cause = $cause->getPrevious()))
			{
				if($cause instanceof \PDOException)
				{
					break;
				}
			}
		}
		
		if($cause instanceof \PDOException)
		{
			switch($this->driverName)
			{
				case DB::DRIVER_MYSQL:
					return $this->convertMySqlException($cause, $e);
				case DB::DRIVER_POSTGRESQL:
					return $this->convertPostgresException($cause, $e);
				case DB::DRIVER_SQLITE:
					return $this->convertSqliteException($cause, $e);
			}
		}
		
		return new DatabaseException($e->getMessage(), 0, $e);
	}
protected function convertDatabaseException ( \ Exception $ e ) { if ( $ e instanceof DatabaseException ) { return $ e ; } // Check for PDO exception in order to determine FK violation: $ cause = $ e ; if ( ! $ cause instanceof \ PDOException ) { while ( NULL !== ( $ cause = $ cause -> getPrevious ( ) ) ) { if ( $ cause instanceof \ PDOException ) { break ; } } } if ( $ cause instanceof \ PDOException ) { switch ( $ this -> driverName ) { case DB :: DRIVER_MYSQL : return $ this -> convertMySqlException ( $ cause , $ e ) ; case DB :: DRIVER_POSTGRESQL : return $ this -> convertPostgresException ( $ cause , $ e ) ; case DB :: DRIVER_SQLITE : return $ this -> convertSqliteException ( $ cause , $ e ) ; } } return new DatabaseException ( $ e -> getMessage ( ) , 0 , $ e ) ; }
Converts the given exception into a DB API exception.

@param \Exception $e
@return DatabaseException
Converts the given exception into a DB API exception .