improve error messages

Send create_object error messages to the new resource id so that
the client can better know what proxy is failing.
Use resource_remove when create_object fails because the core will
already send a remove_id on failure.
Try to send other errors to the proxy that made the request if
possible.
This commit is contained in:
Wim Taymans 2020-02-25 16:38:13 +01:00
parent b96daabb2f
commit 65d72bb87c
9 changed files with 40 additions and 33 deletions

View file

@ -93,15 +93,15 @@ static void *create_object(void *_data,
error_resource:
pw_log_error("can't create resource: %s", spa_strerror(res));
pw_resource_errorf(resource, res, "can't create resource: %s", spa_strerror(res));
pw_resource_errorf_id(resource, new_id, res, "can't create resource: %s", spa_strerror(res));
goto error_exit;
error_node:
pw_log_error("can't create node: %s", spa_strerror(res));
pw_resource_errorf(resource, res, "can't create node: %s", spa_strerror(res));
pw_resource_errorf(node_resource, res, "can't create node: %s", spa_strerror(res));
goto error_exit_free;
error_exit_free:
pw_resource_destroy(node_resource);
pw_resource_remove(node_resource);
error_exit:
errno = -res;
return NULL;