diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-02-03 17:17:27 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-02-03 23:31:58 +0100 |
commit | a842392c30e9ef1d1d2bd9b4eb271c3fd23b853f (patch) | |
tree | e63e44bdfef7999105a2a1fb6f95725cde285b5e /application/core | |
parent | 08dbb3590d64a5c1bf8981f275e47aef84acb4e0 (diff) |
Use exceptions instead of show_error
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/core')
-rw-r--r-- | application/core/MY_Controller.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index 0f71a7fdc..a58d03563 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -18,10 +18,12 @@ class MY_Controller extends CI_Controller { $this->var = new StdClass(); $csrf_protection = true; + $this->load->library('customautoloader'); + // check if DB is up to date if (!$this->input->is_cli_request()) { if (!$this->db->table_exists('migrations')){ - show_error("Database not initialized. Can't find migrations table. Please run the migration script. (php index.php tools update_database)"); + throw new \exceptions\PublicApiException("general/db/not-initialized", "Database not initialized. Can't find migrations table. Please run the migration script. (php index.php tools update_database)"); } else { $this->config->load("migration", true); $target_version = $this->config->item("migration_version", "migration"); @@ -31,7 +33,7 @@ class MY_Controller extends CI_Controller { $current_version = $row ? $row->version : 0; if ($current_version != $target_version) { - show_error("Database version is $current_version, we want $target_version. Please run the migration script. (php index.php tools update_database)"); + throw new \exceptions\PublicApiException("general/db/wrong-version", "Database version is $current_version, we want $target_version. Please run the migration script. (php index.php tools update_database)"); } } } @@ -41,7 +43,6 @@ class MY_Controller extends CI_Controller { mb_internal_encoding('UTF-8'); $this->load->helper(array('form', 'filebin')); - $this->load->library('customautoloader'); if ($this->uri->segment(1) == "api") { is_cli_client(true); |