parse more error codes

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@478 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-02-02 12:19:34 +00:00
parent 2c62acf726
commit 19ae3d3fbb

View file

@ -280,12 +280,21 @@ public abstract class AbstractHafasProvider implements NetworkProvider
if (XmlPullUtil.test(pp, "Err"))
{
final String code = XmlPullUtil.attr(pp, "code");
if (code.equals("K9380"))
if (code.equals("K9380") || code.equals("K895")) // Departure/Arrival are too near
return QueryConnectionsResult.TOO_CLOSE;
if (code.equals("K9220")) // Nearby to the given address stations could not be found
return QueryConnectionsResult.UNRESOLVABLE_ADDRESS;
if (code.equals("K9240")) // Internal error
return new QueryConnectionsResult(Status.SERVICE_DOWN);
if (code.equals("K9260")) // Departure station does not exist
return QueryConnectionsResult.NO_CONNECTIONS;
if (code.equals("K890")) // No connections found
return QueryConnectionsResult.NO_CONNECTIONS;
if (code.equals("K891")) // No route found (try entering an intermediate station)
return QueryConnectionsResult.NO_CONNECTIONS;
if (code.equals("K899")) // An error occurred
return new QueryConnectionsResult(Status.SERVICE_DOWN);
// if (code.equals("K1:890")) // Unsuccessful or incomplete search (direction: forward)
throw new IllegalStateException("error " + code + " " + XmlPullUtil.attr(pp, "text"));
}