From 136c8cdc7328a517d5ce66e70506d9a0a1725f8a Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 27 Jan 2010 22:00:56 -0800 Subject: [PATCH] Fix the AssetProxy macro. --- lib/WebGUI/Macro/AssetProxy.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Macro/AssetProxy.pm b/lib/WebGUI/Macro/AssetProxy.pm index 361c44c09..a1054b9bc 100644 --- a/lib/WebGUI/Macro/AssetProxy.pm +++ b/lib/WebGUI/Macro/AssetProxy.pm @@ -14,6 +14,7 @@ use strict; use Time::HiRes; use WebGUI::Asset; use WebGUI::International; +use WebGUI::Exception; =head1 NAME @@ -45,12 +46,12 @@ sub process { my $t = ($session->errorHandler->canShowPerformanceIndicators()) ? [Time::HiRes::gettimeofday()] : undef; my $asset; if ($type eq 'assetId') { - $asset = WebGUI::Asset->newById($session, $identifier); + $asset = eval { WebGUI::Asset->newById($session, $identifier); }; } else { - $asset = WebGUI::Asset->newByUrl($session,$identifier); + $asset = eval { WebGUI::Asset->newByUrl($session,$identifier); }; } - if (!defined $asset) { + if (WebGUI::Exception->caught()) { $session->errorHandler->warn('AssetProxy macro called invalid asset: '.$identifier .'. The macro was called through this url: '.$session->asset->get('url')); if ($session->var->isAdminOn) {