From 129186c105443accf6595b87f9a6068371884746 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 4 Feb 2010 13:36:48 -0800 Subject: [PATCH] Update Content/Asset for Moose and Exceptions. --- lib/WebGUI/Content/Asset.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Content/Asset.pm b/lib/WebGUI/Content/Asset.pm index 1993e3052..2eb9074dc 100644 --- a/lib/WebGUI/Content/Asset.pm +++ b/lib/WebGUI/Content/Asset.pm @@ -53,7 +53,7 @@ sub getAsset { my $session = shift; my $assetUrl = shift; my $asset = eval{WebGUI::Asset->newByUrl($session,$assetUrl,$session->form->process("revision"))}; - if ($@) { + if (Exception::Class->caught()) { $session->errorHandler->warn("Couldn't instantiate asset for url: ".$assetUrl." Root cause: ".$@); } return $asset; @@ -179,7 +179,10 @@ sub page { } if ($output eq "") { if ($session->var->isAdminOn) { # they're expecting it to be there, so let's help them add it - my $asset = WebGUI::Asset->newByUrl($session, $session->url->getRefererUrl) || WebGUI::Asset->getDefault($session); + my $asset = WebGUI::Asset->newByUrl($session, $session->url->getRefererUrl); + if (Exception::Class->caught()) { + $asset = WebGUI::Asset->getDefault($session); + } $output = $asset->addMissing($assetUrl); } }