IRIS->get_departures_p: return string in first rejection argument

This is consistent with other promises within travelynx
This commit is contained in:
Birte Kristina Friesel 2023-07-09 17:41:47 +02:00
parent 1074f248cc
commit 2123a67ba0
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
2 changed files with 5 additions and 2 deletions

View file

@ -488,7 +488,7 @@ sub startup {
}
)->catch(
sub {
my ($status) = @_;
my ( $err, $status ) = @_;
$promise->reject( $status->{errstr} );
return;
}
@ -2009,7 +2009,7 @@ sub startup {
}
)->catch(
sub {
my ($dep) = @_;
my ( $err, $dep ) = @_;
$self->traewelling->log(
uid => $uid,
message =>

View file

@ -138,6 +138,7 @@ sub get_departures_p {
sub {
my ($err) = @_;
$promise->reject(
$err,
{
results => [],
errstr => "Error in promise: $err",
@ -150,6 +151,7 @@ sub get_departures_p {
}
elsif ( @station_matches > 1 ) {
return Mojo::Promise->reject(
'ambiguous station name',
{
results => [],
errstr =>
@ -160,6 +162,7 @@ sub get_departures_p {
}
else {
return Mojo::Promise->reject(
'unknown station',
{
results => [],
errstr => 'Unbekannte Station',