Skip to content

Response exception after discarded a transaction #1183

@yaxing

Description

@yaxing

Sample code:

Jedis j = new Jedis("host", port);
Transaction t = j.multi();
Response<String> resp = t.get("key");
t.discard();
String data = resp.get();

Such exception got thrown at the last line:

redis.clients.jedis.exceptions.JedisDataException: Please close pipeline or multi block before calling this method.

I see that generateResponse is not called in discard().

Is this expected? The confusing part is that it's the same exception where you forgot to call exec() or even the same when you forgot to sync a pipeline, thus making it hard to handle for a user. Is there any way to handle it better, maybe throwing a different exception saying the transaction got discarded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions