I am using a third party REST API in which every single API call is defined as throws IOException. I am wrapping the REST API in a Repository-style class. However, given the API interface, I am forced to either declare every method in my repository as throws IOException, or wrap every single call and rethrow it as a runtime exception.
Is there any clean way of wrapping the entire API to catch/rethrow as my own custom RuntimeException instead? I know I can wrap the calls using AspectJ and intercept the IOException, but my signature for the method won't change.
Are there any tricks I can use to convert an Exception to a RuntimeException?
For example:
APIWrapper interface has method:
public String getAppBuilds(String report_changed_since, String only_latest, String include_in_progress) throws IOException
In my repo, I would like to be able to call APIWrapper.getAppBuilds()
without needing to catch the IOException.