Use exceptions: it is better to display en error screen than an empty screen
This commit is contained in:
parent
18aff8bfad
commit
843632c30a
@ -141,9 +141,7 @@ class downloadalbum_Controller extends Controller {
|
|||||||
|
|
||||||
// Only send an album
|
// Only send an album
|
||||||
if (!$item->is_album()) {
|
if (!$item->is_album()) {
|
||||||
// @todo: throw an exception?
|
throw new Kohana_Exception('item is not an album: '.$item->relative_path());
|
||||||
Kohana::log('error', 'item is not an album: '.$item->relative_path());
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must have view_full to download the originals files
|
// 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
|
// Go to the parent of album so the ZIP will not contains all the
|
||||||
// server hierarchy
|
// server hierarchy
|
||||||
if (!chdir($album->file_path().'/../')) {
|
if (!chdir($album->file_path().'/../')) {
|
||||||
// @todo: throw an exception?
|
throw new Kohana_Exception('unable to chdir('.$item->file_path().'/../)');
|
||||||
Kohana::log('error', 'unable to chdir('.$item->file_path().'/../)');
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
$cwd = getcwd();
|
$cwd = getcwd();
|
||||||
|
|
||||||
@ -183,9 +179,7 @@ class downloadalbum_Controller extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count($files) === 0) {
|
if (count($files) === 0) {
|
||||||
// @todo: throw an exception?
|
throw new Kohana_Exception('no zippable files in ['.$album->relative_path().']');
|
||||||
Kohana::log('error', 'no zippable files in ['.$album->relative_path().']');
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $files;
|
return $files;
|
||||||
|
Reference in New Issue
Block a user