X Tutup
The Wayback Machine - https://web.archive.org/web/20201203174849/https://github.com/ReactiveX/RxJavaAsyncUtil/issues/9
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic Exception types for ThrowableFuncX #9

Open
simplysoft opened this issue Apr 28, 2016 · 2 comments
Open

Generic Exception types for ThrowableFuncX #9

simplysoft opened this issue Apr 28, 2016 · 2 comments

Comments

@simplysoft
Copy link

@simplysoft simplysoft commented Apr 28, 2016

ThrowableFunc could be made generic in the Exception it throws, this would eliminate the need for broad catch(Exception e) when you are e.g only dealing with IOExceptions (ThrowableFunc & calling method throws IOException)

public interface ThrowingFunc0<R, E extends Exception> extends Function {
        R call() throws E;
}

If you think this is a good idea, we are happy to prepare a pull request

@akarnokd
Copy link
Member

@akarnokd akarnokd commented Apr 28, 2016

We catch Throwables anyway so it doesn't really matter if it throws Exception or a subclass of exception. See Java's Callable<T> wasn't declared as generic throws.

@simplysoft
Copy link
Author

@simplysoft simplysoft commented Apr 28, 2016

We are also using ThrowingFunc on non rxjava-async related code, so the interface throwing Exception make it is a bit verbose, same problem with Callable<T>. But I can understand if that change is outside the scope of this project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
X Tutup