Closed VaughnVernon closed 4 years ago
@Framstag Should be fixed. Please test and confirm.
Updates to current master via bintray...
Modified example as follows:
private fun getUser(id: String): Completes<Response> {
val userId = UserId.from(id)
logger.info("Loading user $userId...")
return stage.maybeActorOf(IUser::class.java,addressFactory.from(userId.toString()))
.andThen {
maybeUser ->
logger.info("Return Response.Status.Ok")
if (maybeUser.isEmpty) {
throw Exception("Not found")
}
Response.of(Response.Status.Ok, serialized(maybeUser.orElse(null)))
}
.recoverFrom {
e ->
logger.error("Error:",e)
logger.warn("Return Response.Status.NotFound: " + e.message)
Response.of(Response.Status.NotFound) // Response
}
}
Exception is caught and printed as expected. Analysed code in debugger. Exception is stored during andThen() and later on handled during recoverFrom() call.
Rest call though does not return (curl is hanging).
When there is an exception thrown prior to the
receiverFrom(Exception)
being registered onBasicCompletes<T>
the outcome should be delayed until the registration is completed. If there is never a registration ofreceiverFrom(Exception)
then the outcome will be unknown.