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

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

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

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants