For error handling in this case, keep in mind that there are multiple kinds of errors. Transport errors (connection failure, etc) will result in the promise being rejected, which for `all` will cause the whole promise to be rejected and the `catch` callback to be called, rendering an exception page (in my example). If you don't want that to happen, add a `catch` handler to each `get_p` promise that doesn't die to turn it into a resolved promise (this example one will just pass the rejection reason along):
my @promises = map { $ua->get_p($_)->catch(sub { @_ }) } @urls; Then when iterating over the results, you will get the string error instead of the $tx if the get_p originally failed. HTTP errors on the other hand you have to check for yourself, they don't affect the resolution of the promise. -Dan On Thu, Feb 7, 2019 at 2:34 PM Ron Bergin <rkber...@gmail.com> wrote: > Stefan, Thanks for the link. I've previously read that post but will need > to read it again. > > Dan, I figured out what was causing that last error. I forgot to load > use Mojo::Util 'trim'; > > The script is now working correctly. Now I need to work on adding error > checking/handling for cases where the url is unreachable. > > -- > 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 mojolicious+unsubscr...@googlegroups.com. > To post to this group, send email to mojolicious@googlegroups.com. > Visit this group at https://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 mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.