summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-07-03 12:14:38 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-07-03 12:14:38 +0200
commit85f4e5b763607450a25c4c684da0d06fb8bc301a (patch)
treefaa8a6b88001d4fd0872871f69773cfb52447b5b
parent3082316697da15afd88e3666e99130eb940e457d (diff)
Traewelling: Custom log message für 409 Conflict; include raw error otherwise1.22.7
-rw-r--r--lib/Travelynx/Helper/Traewelling.pm13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Travelynx/Helper/Traewelling.pm b/lib/Travelynx/Helper/Traewelling.pm
index e71f38c..bd0aa45 100644
--- a/lib/Travelynx/Helper/Traewelling.pm
+++ b/lib/Travelynx/Helper/Traewelling.pm
@@ -354,6 +354,19 @@ sub checkin {
my ($tx) = @_;
if ( my $err = $tx->error ) {
my $err_msg = "HTTP $err->{code} $err->{message}";
+ if ( $tx->res->body ) {
+ if ( $err->{code} == 409 ) {
+ my $j = $tx->res->json;
+ $err_msg .= sprintf(
+': Bereits in %s eingecheckt: https://traewelling.de/status/%d',
+ $j->{error}{lineName},
+ $j->{error}{status_id}
+ );
+ }
+ else {
+ $err_msg .= ' ' . $tx->res->body;
+ }
+ }
if ( $err->{code} != 409
and $err->{code} != 406
and $err->{code} != 401 )