Skip to content

generic_response's adapter throws an exception when receiving an error in an intermediate command #287

@anarthal

Description

@anarthal

The following throws when it shouldn't:

   config cfg;

   request req;
   req.push("PING", "hello");
   req.push("set", "mykey");
   req.push("get", "mykey");

   boost::redis::generic_response resp;

   asio::io_context ioc;
   connection conn{ioc};

   conn.async_run(cfg, asio::detached);

   conn.async_exec(req, resp, [&](auto, auto) {
      std::cout << "on async_exec" << std::endl;
      conn.cancel();
   });

   ioc.run();

The server will respond with, at least, with nodes like the following: [success, error, success].

This causes the adapter to behave incorrectly in these lines. The error node will emplace an error response in the result, and the next success node will invoke result::value(), throwing an exception.

I don't think this is super urgent but should be kept track of. If I have the time to refactor adapters at some point, I'll fix it.

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