Change graphics::generate() API so that it doesn't return a boolean,

instead it throws an exception if there's a problem.  The normal case
for graphics::generate is that it's going to succeed.  It'll only fail
if something un-handleable went wrong, so just use the resulting
exception.
This commit is contained in:
Bharat Mediratta
2009-09-02 15:29:00 -07:00
parent b842a9d9ca
commit 9237ab9bc1
3 changed files with 14 additions and 13 deletions

View File

@@ -60,14 +60,15 @@ class gallery_task_Core {
$item = ORM::factory("item", $row->id);
if ($item->loaded) {
$success = graphics::generate($item);
if (!$success) {
try {
graphics::generate($item);
$ignored[$item->id] = 1;
$errors[] = t("Unable to rebuild images for '%title'",
array("title" => html::purify($item->title)));
} else {
$errors[] = t("Successfully rebuilt images for '%title'",
array("title" => html::purify($item->title)));
} catch (Exception $e) {
$errors[] = t("Unable to rebuild images for '%title'",
array("title" => html::purify($item->title)));
$errors[] = $e->__toString();
}
}