From 9ef7ee79facb3e33b78d563006c715a89d91eff3 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 27 Jan 2010 21:44:06 -0800 Subject: [PATCH] Fix the Widget macro. --- lib/WebGUI/Macro/Widget.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Macro/Widget.pm b/lib/WebGUI/Macro/Widget.pm index b744136c3..ab7e2faee 100644 --- a/lib/WebGUI/Macro/Widget.pm +++ b/lib/WebGUI/Macro/Widget.pm @@ -11,6 +11,9 @@ package WebGUI::Macro::Widget; #------------------------------------------------------------------- use strict; +use WebGUI::Exception; +use WebGUI::Asset; +use WebGUI::Storage; #------------------------------------------------------------------- @@ -55,8 +58,8 @@ sub process { ); # construct the absolute URL and get the asset ID - my $asset = WebGUI::Asset->newByUrl($session, $url); - if ( !$asset ) { + my $asset = eval { WebGUI::Asset->newByUrl($session, $url); }; + if ( Exception::Class->caught() ) { return "Widget: Could not find asset with URL '$url'"; } my $assetId = $asset->getId;