summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-09-10 20:48:24 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-09-10 20:48:45 +0200
commit928a3d6ad4ca39ce913d3df162c56570a8aade4b (patch)
treecc6214c63fe62f39a70b5cb2c893684bfa8dce36 /lib
parentc5b5c1e9afa2f82ee4c234af14e07d07ade6b0d5 (diff)
do not propagate promises where they don't belong
Diffstat (limited to 'lib')
-rw-r--r--lib/DBInfoscreen/Helper/HAFAS.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm
index d5d9a66..6c54a51 100644
--- a/lib/DBInfoscreen/Helper/HAFAS.pm
+++ b/lib/DBInfoscreen/Helper/HAFAS.pm
@@ -92,12 +92,14 @@ sub get_json_p {
$cache->freeze( $url, $json );
$promise->resolve($json);
+ return;
}
)->catch(
sub {
my ($err) = @_;
$self->{log}->warn("get($url): $err");
$promise->reject($err);
+ return;
}
)->wait;
@@ -299,11 +301,19 @@ sub trainsearch_p {
else {
$promise->reject("Zug $opt{train_no} nicht gefunden");
}
+
+ # do not propagate $promise->reject's return value to this promise.
+ # Perl implicitly returns the last statement, so we explicitly return
+ # nothing to avoid this.
+ return;
}
)->catch(
sub {
my ($err) = @_;
$promise->reject($err);
+
+ # do not propagate $promise->reject's return value to this promise
+ return;
}
)->wait;
@@ -426,12 +436,14 @@ sub get_polyline_p {
$cache->freeze( $url, $ret );
$promise->resolve($ret);
+ return;
}
)->catch(
sub {
my ($err) = @_;
$self->{log}->debug("GET $url (error: $err)");
$promise->reject($err);
+ return;
}
)->wait;