diff --git a/core/database.class.php b/core/database.class.php index 67237c1b..641bfe76 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -361,16 +361,26 @@ class Database { } public function commit() { - if(!is_null($this->db) && $this->transaction === true) { - $this->transaction = false; - return $this->db->commit(); + if(!is_null($this->db)) { + if ($this->transaction === true) { + $this->transaction = false; + return $this->db->commit(); + } + else { + throw new SCoreException("

Database Transaction Error: Unable to call commit() as there is no transaction currently open."); + } } } public function rollback() { - if(!is_null($this->db) && $this->transaction === true) { - $this->transaction = false; - return $this->db->rollback(); + if(!is_null($this->db)) { + if ($this->transaction === true) { + $this->transaction = false; + return $this->db->rollback(); + } + else { + throw new SCoreException("

Database Transaction Error: Unable to call rollback() as there is no transaction currently open."); + } } } diff --git a/ext/alias_editor/test.php b/ext/alias_editor/test.php index c67c52cf..efb03d9a 100644 --- a/ext/alias_editor/test.php +++ b/ext/alias_editor/test.php @@ -19,6 +19,7 @@ class AliasEditorTest extends ShimmieWebTestCase { $this->set_field('oldtag', "test1"); $this->set_field('newtag', "test2"); $this->click("Add"); + $this->assert_no_text("Error adding alias"); $this->get_page('alias/list'); $this->assert_text("test1");