Giter Site home page Giter Site logo

Better java support about result HOT 5 CLOSED

kittinunf avatar kittinunf commented on May 18, 2024
Better java support

from result.

Comments (5)

kittinunf avatar kittinunf commented on May 18, 2024

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.

from result.

yoavst avatar yoavst commented on May 18, 2024

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.

from result.

kittinunf avatar kittinunf commented on May 18, 2024

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.

from result.

zjuhasz avatar zjuhasz commented on May 18, 2024

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?

from result.

kittinunf avatar kittinunf commented on May 18, 2024

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.

from result.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.