adjust error messages for failed read operations
All checks were successful
continuous-integration/drone/push Build is passing
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:
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user