Commit 358dd887 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Handle ALL^wmost of the errors!

parent 32afee99
Loading
Loading
Loading
Loading
+24 −12
Original line number Diff line number Diff line
@@ -71,8 +71,6 @@ sub get_results_for {
		  = Travel::Status::DE::IRIS::Stations::get_station($station);
		if ( @station_matches == 1 ) {
			$station = $station_matches[0][0];
		}

			my $status = Travel::Status::DE::IRIS->new(
				station        => $station,
				main_cache     => $cache_iris_main,
@@ -82,9 +80,23 @@ sub get_results_for {
			$data = {
				results => [ $status->results ],
				errstr  => $status->errstr,
			station_name => $status->station->{name},
				station_name =>
				  ( $status->station ? $status->station->{name} : $station ),
			};
		}
		elsif ( @station_matches > 1 ) {
			$data = {
				results => [],
				errstr  => 'Ambiguous station name',
			};
		}
		else {
			$data = {
				results => [],
				errstr  => 'Unknown station name',
			};
		}
	}
	elsif ( $backend eq 'ris' ) {
		$data = $cache_hafas->thaw($cache_str);
		if ( not $data ) {