adjust error messages for failed read operations
All checks were successful
continuous-integration/drone/push Build is passing

The error message "failed to read from API" is quite generic.
We now add the information what should have been read from API
if possible.
This commit is contained in:
Stefan Kalscheuer 2020-08-12 11:50:42 +02:00
parent 8017f2671d
commit b14d040e4f
2 changed files with 4 additions and 4 deletions

View File

@ -260,7 +260,7 @@ public class UraClient implements Serializable {
line = br.readLine();
}
} catch (IOException e) {
throw new IllegalStateException("Failed to read from API", e);
throw new IllegalStateException("Failed to read trips from API", e);
}
return trips;
}
@ -330,7 +330,7 @@ public class UraClient implements Serializable {
}
}
} catch (IOException e) {
throw new IllegalStateException("Failed to read from API", e);
throw new IllegalStateException("Failed to read stops from API", e);
}
return stops;
}
@ -385,7 +385,7 @@ public class UraClient implements Serializable {
line = br.readLine();
}
} catch (IOException e) {
throw new IllegalStateException("Failed to read from API", e);
throw new IllegalStateException("Failed to read messages from API", e);
}
return messages;
}

View File

@ -134,7 +134,7 @@ public class AsyncUraTripReader implements AutoCloseable {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
throw new IllegalStateException("Failed to read from API", e);
throw new IllegalStateException("Failed to close API connection", e);
} catch (TimeoutException e) {
// Task failed to finish within 1 second.
future.cancel(true);