summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-02-21 20:36:16 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-02-21 20:36:16 +0100
commit893ee14e4d3ca267777cc2d929d89bb47d13a2fd (patch)
tree70bde9f583a07a413d65cf201dd6176962a1ddc9 /lib/Travel/Status
parentde145ca1fd960e3e8860a98cfbccb317c367065a (diff)
Fix new_p
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/DBRIS.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/DBRIS.pm b/lib/Travel/Status/DE/DBRIS.pm
index 57560ef..196d8ba 100644
--- a/lib/Travel/Status/DE/DBRIS.pm
+++ b/lib/Travel/Status/DE/DBRIS.pm
@@ -186,7 +186,7 @@ sub new_p {
my $self = $obj->new( %conf, async => 1 );
$self->{promise} = $conf{promise};
- $self->get_with_cache_p( $self->{url} )->then(
+ $self->get_with_cache_p( $self->{req} )->then(
sub {
my ($content) = @_;
$self->{raw_json} = $self->{json}->decode($content);
@@ -203,8 +203,12 @@ sub new_p {
elsif ( $conf{formation} ) {
$self->parse_formation( $conf{formation} );
}
+
+ if ( $self->errstr ) {
+ $promise->reject( $self->errstr, $self );
+ }
else {
- $promise->reject( 'dead code path reached in new_p', $self );
+ $promise->resolve($self);
}
return;
}