From 1c4f84ab13e72d3bfdcd9b753b6353f8235a0807 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 19 Apr 2007 03:36:50 +0000 Subject: [PATCH] Added better error handling in asset instanciation. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset.pm | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index b4ac56888..84ab929f8 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,6 +8,7 @@ http://www.plainblack.com/bugs/tracker/trouble-with-search-users - fix: Fixed an unhandled exception in Workflow/Activity/PurgeOldAssetRevisions.pm - Added better error handling for asset instanciation in version tags. + - Added better error handling in asset instanciation. - fix: Image::Magick->Scale does nothing if given dimensions < 1, so make sure they are large enough when generating thumbnails in Storage/Image.pm diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index a0ad7fdb8..a1cb251e1 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1510,7 +1510,10 @@ sub new { $where .= " and (asset.assetId=".$definition->{tableName}.".assetId and ".$definition->{tableName}.".revisionDate=".$revisionDate.")"; } $properties = $session->db->quickHashRef($sql.$where); - return undef unless (exists $properties->{assetId}); + unless (exists $properties->{assetId}) { + $session->errorHandler->error("Asset $assetId $class $revisionDate is missing properties. Consult your database tables for corruption. "); + return undef; + } $cache->set($properties,60*60*24); } if (defined $properties) {