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

Better java support #13

Closed
yoavst opened this issue Feb 21, 2016 · 5 comments
Closed

Better java support #13

yoavst opened this issue Feb 21, 2016 · 5 comments

Comments

@yoavst
Copy link
Contributor

yoavst commented Feb 21, 2016

Since it is based on extension methods, it doesn't play well on Java.

@kittinunf
Copy link
Owner

Well, unlike Fuel, I don't think Result should support Java. It aims at the beginning that it was meant to support Kotlin and solely Kotlin.

@yoavst
Copy link
Contributor Author

yoavst commented Feb 23, 2016

I'm not requesting for a lot, just a way to know if it is failed (only possible in try catch of get() or component2()) and getting the exception, from Java.

@kittinunf
Copy link
Owner

Fair enough. I haven't used Java for a big while for I wouldn't know exactly what really Java client wants. If you have some proposal and it doesn't alter Result too much, I am happy to accept it.

@zjuhasz
Copy link

zjuhasz commented Aug 18, 2016

I'm not interested in Java support but if this is meant solely to target Kotlin I'm wondering why the errors in Result require Exception as a base class as opposed to Kotlin's Throwable?

@kittinunf
Copy link
Owner

kittinunf commented Aug 18, 2016

Good point! Thanks for asking. When I designed this Result class (which was kinda long ago), I considered Throwableas well. However, I dropped it at the last minute in favor of Exception.

There is a reason for it though. If I use Throwable, client could use Error for a Failure case in Result which is not semantically what I want. I prefer the Failure case to be an error state which is recoverable, that is mostly like be represented by Exception as opposed to a non-recoverable (serious) like Error.

If you could come up with a use case which is likely better to represent as Throwable, I am happy to discuss.

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

3 participants