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

View file

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