From 843632c30ae8f078e8f105943241e59f79712858 Mon Sep 17 00:00:00 2001 From: Romain LE DISEZ Date: Wed, 27 Oct 2010 23:21:03 +0200 Subject: [PATCH] Use exceptions: it is better to display en error screen than an empty screen --- .../downloadalbum/controllers/downloadalbum.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/3.0/modules/downloadalbum/controllers/downloadalbum.php b/3.0/modules/downloadalbum/controllers/downloadalbum.php index 201887cf..c3696263 100644 --- a/3.0/modules/downloadalbum/controllers/downloadalbum.php +++ b/3.0/modules/downloadalbum/controllers/downloadalbum.php @@ -141,9 +141,7 @@ class downloadalbum_Controller extends Controller { // Only send an album if (!$item->is_album()) { - // @todo: throw an exception? - Kohana::log('error', 'item is not an album: '.$item->relative_path()); - exit; + throw new Kohana_Exception('item is not an album: '.$item->relative_path()); } // Must have view_full to download the originals files @@ -161,9 +159,7 @@ class downloadalbum_Controller extends Controller { // Go to the parent of album so the ZIP will not contains all the // server hierarchy if (!chdir($album->file_path().'/../')) { - // @todo: throw an exception? - Kohana::log('error', 'unable to chdir('.$item->file_path().'/../)'); - exit; + throw new Kohana_Exception('unable to chdir('.$item->file_path().'/../)'); } $cwd = getcwd(); @@ -183,9 +179,7 @@ class downloadalbum_Controller extends Controller { } if (count($files) === 0) { - // @todo: throw an exception? - Kohana::log('error', 'no zippable files in ['.$album->relative_path().']'); - exit; + throw new Kohana_Exception('no zippable files in ['.$album->relative_path().']'); } return $files;