diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-10-23 20:08:01 +0200 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-10-23 20:08:01 +0200 |
commit | 481c49a3c279fa0cc684f0c0c724b248b9ac149c (patch) | |
tree | 5ec7fa828d513b5d4608ff94922154372e817809 | |
parent | 3e2e9cf71d4670e96148f32621c200284ad03d07 (diff) |
import: Catch errors in get_single and sanity_check
-rwxr-xr-x | lib/Travelynx/Controller/Api.pm | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index f4f771e..b732810 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -571,14 +571,20 @@ sub import_v1 { my $journey; if ( not $error ) { - $journey = $self->journeys->get_single( - uid => $uid, - db => $db, - journey_id => $journey_id, - verbose => 1 - ); - $error - = $self->journeys->sanity_check( $journey, $payload->{lax} ? 1 : 0 ); + eval { + $journey = $self->journeys->get_single( + uid => $uid, + db => $db, + journey_id => $journey_id, + verbose => 1 + ); + $error + = $self->journeys->sanity_check( $journey, + $payload->{lax} ? 1 : 0 ); + }; + if ($@) { + $error = $@; + } } if ($error) { |