Have you tried Try::Tiny?

try {
...
} catch {
  say "error: $_";
};

HtH, Sergey Dmitriev
*"All that is necessary for evil to triumph is for good men to do nothing".
-- Edmund Burke*


2014-04-06 17:42 GMT+04:00 Stanislav Blinov <[email protected]>:

> Hi,
>
> I am trying to catch exception that raises when Mojo::DOM cannot find
> anything at specified location.
>
> For example, when I run:
> $content = $dom->at('html body div#ja-contents > table + table > tr > td')
> ;
>
> I am getting exception page with following error: [...]Can&#39;t call
> method &quot;find&quot; on an undefined value at
> script/../lib/Cms/Admin.pm line 934.[...]
>
> When I am trying:
>
> eval {
> $content = $dom->at('html body div#ja-contents > table + table > tr > td')
> ;
> }
> or do {
> $self->render(text => Dumper($@));
> return;
> };
>
> The string is just empty.
> Is there is anyway to render as text only error message that I am
> getting without eval?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to