Comments (8)
Hey @postfixNotation,
I think there are a couple of things we can do, but not sure which is the best one π€ It also depends a bit on your use-case.
-
There is also Ktorfit, but the adapter we have doesn't work with that one but it should be very easy to port.
-
We write a new module for Ktor, which I think multiple people have shown interest in. However, there are two options here
- Re-use CallError from Retrofit library, this would be least breaking for you
- Use different sealed class for Ktor, since it support different kind of errors. I think for Ktor
Either<HttpStatusCode, A>
might be better. Ordata class CallError(val code: HttpStatusCode, val call: ApplicationCall)
, andEither<CallError, A>
.
from arrow.
Hey @postfixNotation,
Is there an estimation of how long this might take?
There is only a couple of maintainers, and sadly this is on none of our priority list. We already have more work than we can handle in our spare free time.
However, if you'd like to work on this I'd be more than happy to guide, and support you!
from arrow.
Hi @nomisRev,
thanks for your quick and helpful reply!
Ktorfit looks pretty neat and it's good to know about this option. However I'm planning to delve into Ktor extensively since I'd also like to write my own backend. Also I want my project to have as few dependencies as possible and also to mostly rely on robust long-term solutions. Depending on intermediary layers/services is probably not sustainable for my requirements.
A module, as proposed in your last message, would be amazing and also very beneficial for the whole community. "Retrofit's" CallError might be exposed as a typealias in an appropriately scoped package of such a module which would be least breaking for me, as of my understanding. But a correctly modeled approach, as described in your last point, might probably be the most beneficial solution.
Is there an estimation of how long this might take?
Thanks!
from arrow.
Hi @nomisRev,
As soon as I migrate from Retrofit to Ktor to make my app multiplatform compatible I will consider working on this feature. Right now I have zero knowledge of and experience with Ktor's API surface and paradigm which is why it's hard to make any commitments.
But this could be my first open source contribution which is pretty exciting and a good learning experience, so we'll see :-)
I'm also looking for a good multiplatform DI solution but the existing one's are too risky since many of them don't provide compile time safety. I came across Kotlin context receivers and their potential ability to act as 3rd party DI framework replacement.
I know it's not related to this issue but is there still any work in progress from Arrow's site with respect to this functionality? The respective repository seems not to be actively maintained anymore.
Have a great weekend!
from arrow.
Hi @nomisRev and @postfixNotation
would be interested to work on that and provide a PR
I have experimented a bit and already have a basic adapter for KtorFit but would also like to check out option #2
Please let me know if that's OK for both of you
from arrow.
Hi @nomisRev and @postfixNotation
would be interested to work on that and provide a PR
I have experimented a bit and already have a basic adapter for KtorFit but would also like to check out option #2
Please let me know if that's OK for both of you
It would be amazing if someone worked on this issue since I have different priorities at the moment :-)
from arrow.
Here is my result so far: https://github.com/abendt/arrow-ktor/blob/main/src/main/kotlin/demo/ExampleApi.kt
There you can see how you can use Either<Exception, A>
in your Ktorfit client. Should also be possible to support some custom CallError
on the left side.
Let me know if that looks useful to you and what other requirements & ideas you might have
from arrow.
Here is my result so far: https://github.com/abendt/arrow-ktor/blob/main/src/main/kotlin/demo/ExampleApi.kt
There you can see how you can use
Either<Exception, A>
in your Ktorfit client. Should also be possible to support some customCallError
on the left side.Let me know if that looks useful to you and what other requirements & ideas you might have
Hi @abendt!
This looks pretty interesting and very easy to use.
I'm still stuck with Retrofit but I assume I would migrate to Ktor Client without using Ktorfit. Although it looks pretty straight forward to use.
I think the most pragmatic and helpful approach would be to work on solution 2.2) of @nomisRev post above.
from arrow.
Related Issues (20)
- ["Documentation"] Ior Knit examples not rendering properly
- autoCloseScope: the order of close method calls is not the same as `AutoCloseable.use` HOT 2
- Tracing reports a swallowed CancellationException warning HOT 7
- Fold restriction not allowing any Function<*> to be returned is too strict HOT 20
- ["Request"] Raise DSL for working with nonEmptyLists HOT 3
- @optics generates bad code for data class with generic named 'S' HOT 1
- ["Bug"] Arrow core 1.2.4 not compatible with Kotlin WASM JS HOT 3
- ["Request"] Annotate Raise interface with @RaiseDSL HOT 2
- Discussion around the Gradle setup HOT 3
- ["Request"] Resilience Saga allow
- ["Request"] mention `result` computation block API in learning docs
- Update Arrow 2.0.0-alpha.2 misses a dependency HOT 3
- ["BUG"] Arrow Optics, `it` package in lambda
- Can't import KSP plugin using BoM HOT 1
- Duplicate class for arrow-optics-compose
- Saga with raise inside SagaActionStep don't rollback HOT 3
- ["Request"] `OptionRaise` available in `Option.catch {}`
- Flaky `RaceNJvmTest.firstRacerOutOf2AlwaysWinsOnASingleThread()` tests
- @optics generates bad code for class named Object
- Either.isRight() contract's seems to not works HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arrow.