Client-side typesafe Spine schema usage • opensavvy.spine.client • handle
handle¶
Exhaustively handle failures.
If the request is succesful, transform is called. If the request fails with the error F1, handle1 is called.
To learn more about failures, see the documentation.
Example¶
client.request(Api / Users / Users.create).handle(
handle1 = { println("Failed with $it") },
) { println("Created: " + it) }
See also¶
-
bodyOrNullTreat all failures asnull. -
bodyOrThrowTreat all failures as exceptions.
Exhaustively handle failures.
If the request is succesful, transform is called. If the request fails with an error, the corresponding handler is called.
To learn more about failures, see the documentation.
Example¶
client.request(Api / Users / Users.create).handle(
handle1 = { println("Failed with $it") },
) { println("Created: " + it) }
See also¶
-
bodyOrNullTreat all failures asnull. -
bodyOrThrowTreat all failures as exceptions.
Exhaustively handle failures.
If the request is succesful, transform is called. If the request fails with an error, the corresponding handler is called.
To learn more about failures, see the documentation.
Example¶
client.request(Api / Users / Users.create).handle(
handle1 = { println("Failed with $it") },
) { println("Created: " + it) }
See also¶
-
bodyOrNullTreat all failures asnull. -
bodyOrThrowTreat all failures as exceptions.
inline suspend fun <Out : Any, O, F1, F2, F3, F4> SpineResponse<Out, FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Never, FailureSpec.ByCode<F1>>, FailureSpec.ByCode<F2>>, FailureSpec.ByCode<F3>>, FailureSpec.ByCode<F4>>>.handle(handle1: (F1) -> O, handle2: (F2) -> O, handle3: (F3) -> O, handle4: (F4) -> O, transform: (Out) -> O): O
Exhaustively handle failures.
If the request is succesful, transform is called. If the request fails with an error, the corresponding handler is called.
To learn more about failures, see the documentation.
Example¶
client.request(Api / Users / Users.create).handle(
handle1 = { println("Failed with $it") },
) { println("Created: " + it) }
See also¶
-
bodyOrNullTreat all failures asnull. -
bodyOrThrowTreat all failures as exceptions.
inline suspend fun <Out : Any, O, F1, F2, F3, F4, F5> SpineResponse<Out, FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Never, FailureSpec.ByCode<F1>>, FailureSpec.ByCode<F2>>, FailureSpec.ByCode<F3>>, FailureSpec.ByCode<F4>>, FailureSpec.ByCode<F5>>>.handle(handle1: (F1) -> O, handle2: (F2) -> O, handle3: (F3) -> O, handle4: (F4) -> O, handle5: (F5) -> O, transform: (Out) -> O): O
Exhaustively handle failures.
If the request is succesful, transform is called. If the request fails with an error, the corresponding handler is called.
To learn more about failures, see the documentation.
Example¶
client.request(Api / Users / Users.create).handle(
handle1 = { println("Failed with $it") },
) { println("Created: " + it) }
See also¶
-
bodyOrNullTreat all failures asnull. -
bodyOrThrowTreat all failures as exceptions.
inline suspend fun <Out : Any, O, F1, F2, F3, F4, F5, F6> SpineResponse<Out, FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Or<FailureSpec.Never, FailureSpec.ByCode<F1>>, FailureSpec.ByCode<F2>>, FailureSpec.ByCode<F3>>, FailureSpec.ByCode<F4>>, FailureSpec.ByCode<F5>>, FailureSpec.ByCode<F6>>>.handle(handle1: (F1) -> O, handle2: (F2) -> O, handle3: (F3) -> O, handle4: (F4) -> O, handle5: (F5) -> O, handle6: (F6) -> O, transform: (Out) -> O): O
Exhaustively handle failures.
If the request is succesful, transform is called. If the request fails with an error, the corresponding handler is called.
To learn more about failures, see the documentation.
Example¶
client.request(Api / Users / Users.create).handle(
handle1 = { println("Failed with $it") },
) { println("Created: " + it) }
See also¶
-
bodyOrNullTreat all failures asnull. -
bodyOrThrowTreat all failures as exceptions.