roadrunner icon indicating copy to clipboard operation
roadrunner copied to clipboard

[💡 FEATURE REQUEST]: RPC response error code classification

Open rauanmayemir opened this issue 3 years ago • 1 comments

Plugin

No response

I have an idea!

I have an idea, listen to me!!

The latest direction of RR giving control of the server via RPC commands with protobuf messages is absolutely amazing. In the same spirit, it would be nice to have a way to distinguish response errors. E.g, consider Jobs pipeline creation:

$pipeline = $this->jobs->create(
    new AMQPCreateInfo(
        name: 'pipeline_1',
        prefetch: 1,
        queue: 'queue_1',
        exchange: 'amqp.direct',
        routingKey: 'queue_1',
        multipleAck: false,
        requeueOnFail: false,
    )
);

If the pipeline already exists, JobsInterface will throw JobsException, but on the PHP side, we have no way of knowing whether it's the issue with the already existing pipeline and not e.g RPC failure or something else.

We'd have to look into the exception message which is great for debugging, but not so much for building user-specific workflows around it.

It would help if JobsException also had a code given from RPC. We could also split up exceptions like Jobs\PipelineAlreadyExistsException, but that would still require passing an error code from the RPC.

rauanmayemir avatar Jun 15 '22 06:06 rauanmayemir

@rauanmayemir Hey 👋🏻 This is a nice feature; however, we can't send an error code, the only error itself for the RPC. Also we can't break an API to send an error code in the return value (avoiding sending the error).

This feature will be nice in the RRv3.

rustatian avatar Jul 02 '22 10:07 rustatian