Closed rainmanhhh closed 1 year ago
I don't see null
as synonymous with failure; some methods have @Nullable
results, for example:
io.vertx.redis.client.RedisAPI
default RedisAPI append(String arg0, String arg1, Handler<AsyncResult<@Nullable Response>> handler) {
send(Command.APPEND, arg0, arg1).setHandler(handler);
return this;
}
io.vertx.kotlin.redis.client.RedisAPI
suspend fun RedisAPI.appendAwait(arg0: String, arg1: String): Response? {
return awaitResult {
this.append(arg0, arg1, it)
}
}
NOTE: the parameter is [T] but not [T: Any] so if the action return value is actually nullable(eg. [Response?]), just call it like this: executeBlockingAwait<Response?>(...) [Response?] can be omitted
The return type is T?
because when the call succeeds, the result can be null
.
executeBlockingAwait calls awaitResult If awaitResult failed, it will throw an exception instead of return null The return type should be [T] but not [T?]