Exception handling for Thumbnail macro.
This commit is contained in:
parent
a2feddc3b5
commit
97d5caab17
1 changed files with 9 additions and 7 deletions
|
|
@ -32,13 +32,15 @@ Image Asset can be found with that URL, then undef will be returned.
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
my $url = shift;
|
||||
if (my $image = WebGUI::Asset::File::Image->newByUrl($session,$url)) {
|
||||
return $image->getThumbnailUrl;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
my $session = shift;
|
||||
my $url = shift;
|
||||
my $image = eval { WebGUI::Asset::File::Image->newByUrl($session,$url) };
|
||||
if (Exception::Class->caught()) {
|
||||
return undef;
|
||||
}
|
||||
else {
|
||||
return $image->getThumbnailUrl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue