resource: improve error handling

Make some more varargs error functions
Make pw_resource_error always just send the error to the resource id.
Make sure we send errors to the right destination.
Add proxy error event and emit it when the core finds an error for
the given proxy id.
The client error is supposed to be sent to all resources of a client
for the given global.
This commit is contained in:
Wim Taymans 2019-02-14 16:53:42 +01:00
parent cbdc024f4c
commit 8ae5424359
17 changed files with 107 additions and 64 deletions

View file

@ -246,30 +246,30 @@ static void *create_object(void *_data,
no_properties:
pw_log_error("link-factory needs properties");
pw_resource_error(resource, new_id, -EINVAL, "no properties");
pw_resource_error(resource, -EINVAL, "no properties");
goto done;
no_output:
pw_log_error("link-factory unknown output node %d", output_node_id);
pw_resource_error(resource, new_id, -EINVAL, "unknown output node");
pw_log_error("link-factory unknown output node %u", output_node_id);
pw_resource_error(resource, -EINVAL, "unknown output node %u", output_node_id);
goto done;
no_input:
pw_log_error("link-factory unknown input node %d", input_node_id);
pw_resource_error(resource, new_id, -EINVAL, "unknown input node");
pw_log_error("link-factory unknown input node %u", input_node_id);
pw_resource_error(resource, -EINVAL, "unknown input node %u", input_node_id);
goto done;
no_output_port:
pw_log_error("link-factory unknown output port %d", output_port_id);
pw_resource_error(resource, new_id, -EINVAL, "unknown output port");
pw_log_error("link-factory unknown output port %u", output_port_id);
pw_resource_error(resource, -EINVAL, "unknown output port %u", output_port_id);
goto done;
no_input_port:
pw_log_error("link-factory unknown input port %d", input_port_id);
pw_resource_error(resource, new_id, -EINVAL, "unknown input port");
pw_log_error("link-factory unknown input port %u", input_port_id);
pw_resource_error(resource, -EINVAL, "unknown input port %u", input_port_id);
goto done;
no_mem:
pw_log_error("can't create link: %s", error);
pw_resource_error(resource, new_id, -ENOMEM, error);
pw_resource_error(resource, -ENOMEM, "can't create link: %s", error);
goto done;
no_bind:
pw_resource_error(resource, new_id, res, "can't bind link");
pw_resource_error(resource, res, "can't bind link");
goto done;
done:
if (properties)