From a660a937a7acfb5408bcf4d0784a622f192b6237 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 8 Jun 2013 23:01:31 +0300 Subject: [PATCH] always throw exception on DB error --- ipf/orm.php | 1 - ipf/orm/configurable.php | 1 - ipf/orm/connection.php | 13 +++---------- ipf/orm/manager.php | 1 - 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/ipf/orm.php b/ipf/orm.php index 5f52119..d3427c3 100644 --- a/ipf/orm.php +++ b/ipf/orm.php @@ -129,7 +129,6 @@ final class IPF_ORM { const ATTR_CACHE_LIFESPAN = 151; const ATTR_RESULT_CACHE_LIFESPAN = 151; const ATTR_LOAD_REFERENCES = 153; - const ATTR_THROW_EXCEPTIONS = 155; const ATTR_DEFAULT_PARAM_NAMESPACE = 156; const ATTR_QUERY_CACHE = 157; const ATTR_QUERY_CACHE_LIFESPAN = 158; diff --git a/ipf/orm/configurable.php b/ipf/orm/configurable.php index 2a2e759..6d448e1 100644 --- a/ipf/orm/configurable.php +++ b/ipf/orm/configurable.php @@ -71,7 +71,6 @@ abstract class IPF_ORM_Configurable extends IPF_ORM_Locator_Injectable case IPF_ORM::ATTR_EXPORT: case IPF_ORM::ATTR_DECIMAL_PLACES: case IPF_ORM::ATTR_LOAD_REFERENCES: - case IPF_ORM::ATTR_THROW_EXCEPTIONS: case IPF_ORM::ATTR_DEFAULT_PARAM_NAMESPACE: case IPF_ORM::ATTR_AUTOLOAD_TABLE_CLASSES: case IPF_ORM::ATTR_MODEL_LOADING: diff --git a/ipf/orm/connection.php b/ipf/orm/connection.php index 9a4b4f1..7956948 100644 --- a/ipf/orm/connection.php +++ b/ipf/orm/connection.php @@ -548,22 +548,15 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta public function rethrowException(Exception $e, $invoker) { $event = new IPF_ORM_Event($this, IPF_ORM_Event::CONN_ERROR); + $this->notifyDBListeners('onError', $event); - $this->notifyDBListeners('preError', $event); - $name = 'IPF_ORM_Exception_' . $this->driverName; - $exc = new $name($e->getMessage(), (int) $e->getCode()); - if ( ! is_array($e->errorInfo)) { + if (!is_array($e->errorInfo)) { $e->errorInfo = array(null, null, null, null); } $exc->processErrorInfo($e->errorInfo); - - if ($this->getAttribute(IPF_ORM::ATTR_THROW_EXCEPTIONS)) { - throw $exc; - } - - $this->notifyDBListeners('postError', $event); + throw $exc; } public function hasTable($name) diff --git a/ipf/orm/manager.php b/ipf/orm/manager.php index b76b5b0..6469490 100644 --- a/ipf/orm/manager.php +++ b/ipf/orm/manager.php @@ -24,7 +24,6 @@ class IPF_ORM_Manager extends IPF_ORM_Configurable implements Countable, Iterato IPF_ORM::ATTR_RESULT_CACHE => null, IPF_ORM::ATTR_QUERY_CACHE => null, IPF_ORM::ATTR_LOAD_REFERENCES => true, - IPF_ORM::ATTR_THROW_EXCEPTIONS => true, IPF_ORM::ATTR_IDXNAME_FORMAT => "%s_idx", IPF_ORM::ATTR_SEQNAME_FORMAT => "%s_seq", IPF_ORM::ATTR_TBLNAME_FORMAT => "%s", -- 2.49.0