From e873f5e6533d94d18b77249ed633b9c6f5563f26 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 28 Jan 2010 13:09:59 -0800 Subject: [PATCH] Fix Search.pm for WebGUI::Definition and exceptions. --- lib/WebGUI/Search.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Search.pm b/lib/WebGUI/Search.pm index 7d401946c..3038ac9f5 100644 --- a/lib/WebGUI/Search.pm +++ b/lib/WebGUI/Search.pm @@ -117,13 +117,13 @@ Returns an array reference containing asset objects for those that matched. sub getAssets { my $self = shift; - my $query = $self->_getQuery([qw(assetIndex.assetId assetIndex.className assetIndex.revisionDate)]); + my $query = $self->_getQuery([qw(assetIndex.assetId assetIndex.revisionDate)]); my $rs = $self->session->db->prepare($query); $rs->execute($self->{_params}); my @assets = (); while (my ($id, $class, $version) = $rs->array) { - my $asset = WebGUI::Asset->new($self->session, $id, $class, $version); - unless (defined $asset) { + my $asset = eval { WebGUI::Asset->newById($self->session, $id, $version); }; + if (Exception::Class->caught()) { $self->session->errorHandler->warn("Search index contains assetId $id even though it no longer exists."); next; }