summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Travel/Status/DE/EFA.pm23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index 2704c3e..7dfbc3b 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -43,7 +43,8 @@ sub new_p {
say $self->{json}->pretty->encode( $self->{response} );
}
- $self->check_for_ambiguous();
+ $self->check_for_ambiguous;
+ $self->check_for_error;
if ( $self->{errstr} ) {
$promise->reject( $self->{errstr}, $self );
@@ -297,7 +298,8 @@ sub new {
say $self->{json}->pretty->encode( $self->{response} );
}
- $self->check_for_ambiguous();
+ $self->check_for_ambiguous;
+ $self->check_for_error;
return $self;
}
@@ -418,6 +420,23 @@ sub place_candidates {
return;
}
+sub check_for_error {
+ my ($self) = @_;
+
+ my $json = $self->{response};
+
+ my %kv;
+ for my $m ( @{ $json->{dm}{message} // [] } ) {
+ $kv{ $m->{name} } = $m->{value};
+ }
+
+ if ( $kv{error} ) {
+ $self->{errstr} = "Backend error: $kv{error}";
+ }
+
+ return;
+}
+
sub check_for_ambiguous {
my ($self) = @_;