summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-01-30 11:28:30 +0100
committerDaniel Friesel <derf@finalrewind.org>2022-01-30 11:28:30 +0100
commite89ed392bb06abf8cc36d31b3b033ef2b2abf57b (patch)
treef036992140c30e05a54ae75349d215b9ca496b48 /lib/Travel/Status/DE/IRIS.pm
parentf223e10169b5b5bb57a270f7d6631d8ffb62050b (diff)
Gracefully handle failed realtime data requests
Diffstat (limited to 'lib/Travel/Status/DE/IRIS.pm')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index 1be5808..79e96d9 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -135,10 +135,20 @@ sub new_p {
for my $eva (@related_stations) {
push( @realtime_reqs, $self->get_realtime_p( $eva, $dt_req ) );
}
- return $self->{promise}->all(@realtime_reqs);
+ return $self->{promise}->all_settled(@realtime_reqs);
}
)->then(
sub {
+ my @realtime_results = @_;
+
+ for my $realtime_result (@realtime_results) {
+ if ( $realtime_result->{status} eq 'rejected' ) {
+ $self->{warnstr} //= q{};
+ $self->{warnstr}
+ .= "Realtime data request failed: $realtime_result->{reason}. ";
+ }
+ }
+
$self->postprocess_results;
$promise->resolve($self);
return;