mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
improve error messages
Log an error when we send an error to the client so that we don't need to log and error anymore. Improve the error messages when we can Move some warnings and errors to debug
This commit is contained in:
parent
ee617682c3
commit
b33bd68bac
12 changed files with 56 additions and 62 deletions
|
|
@ -285,36 +285,31 @@ static void *create_object(void *_data,
|
|||
|
||||
error_properties:
|
||||
res = -EINVAL;
|
||||
pw_log_error(NAME" usage:" FACTORY_USAGE);
|
||||
pw_resource_error(resource, res, "no properties");
|
||||
pw_resource_error(resource, res, NAME": no properties. usage:"FACTORY_USAGE);
|
||||
goto error_exit;
|
||||
error_output:
|
||||
res = -EINVAL;
|
||||
pw_log_error(NAME" unknown output node %u", output_node_id);
|
||||
pw_resource_errorf(resource, res, "unknown output node %u", output_node_id);
|
||||
pw_resource_errorf(resource, res, NAME": unknown output node %u", output_node_id);
|
||||
goto error_exit;
|
||||
error_input:
|
||||
res = -EINVAL;
|
||||
pw_log_error(NAME" unknown input node %u", input_node_id);
|
||||
pw_resource_errorf(resource, res, "unknown input node %u", input_node_id);
|
||||
pw_resource_errorf(resource, res, NAME": unknown input node %u", input_node_id);
|
||||
goto error_exit;
|
||||
error_output_port:
|
||||
res = -EINVAL;
|
||||
pw_log_error(NAME" unknown output port %u", output_port_id);
|
||||
pw_resource_errorf(resource, res, "unknown output port %u", output_port_id);
|
||||
pw_resource_errorf(resource, res, NAME": unknown output port %u", output_port_id);
|
||||
goto error_exit;
|
||||
error_input_port:
|
||||
res = -EINVAL;
|
||||
pw_log_error(NAME" unknown input port %u", input_port_id);
|
||||
pw_resource_errorf(resource, res, "unknown input port %u", input_port_id);
|
||||
pw_resource_errorf(resource, res, NAME": unknown input port %u", input_port_id);
|
||||
goto error_exit;
|
||||
error_create_link:
|
||||
pw_log_error("can't create link: %s", spa_strerror(res));
|
||||
pw_resource_errorf(resource, res, "can't create link: %s", spa_strerror(res));
|
||||
pw_resource_errorf(resource, res, NAME": can't link ports %d and %d: %s",
|
||||
pw_impl_port_get_id(outport), pw_impl_port_get_id(inport),
|
||||
spa_strerror(res));
|
||||
goto error_exit;
|
||||
error_link_register:
|
||||
pw_log_error("can't register link: %s", spa_strerror(res));
|
||||
pw_resource_errorf(resource, res, "can't register link: %s", spa_strerror(res));
|
||||
pw_resource_errorf(resource, res, NAME": can't register link: %s", spa_strerror(res));
|
||||
goto error_exit;
|
||||
error_exit:
|
||||
if (properties)
|
||||
|
|
|
|||
|
|
@ -179,8 +179,6 @@ process_messages(struct client_data *data)
|
|||
|
||||
resource = pw_impl_client_find_resource(client, msg->id);
|
||||
if (resource == NULL) {
|
||||
pw_log_error(NAME" %p: unknown resource %u op:%u",
|
||||
client->protocol, msg->id, msg->opcode);
|
||||
pw_resource_errorf(client->core_resource,
|
||||
-EINVAL, "unknown resource %u op:%u", msg->id, msg->opcode);
|
||||
continue;
|
||||
|
|
@ -202,10 +200,9 @@ process_messages(struct client_data *data)
|
|||
required = demarshal[msg->opcode].permissions | PW_PERM_X;
|
||||
|
||||
if ((required & permissions) != required) {
|
||||
pw_log_error(NAME" %p: method %u on %u requires %08x, have %08x",
|
||||
client->protocol, msg->opcode, msg->id, required, permissions);
|
||||
pw_resource_errorf(resource,
|
||||
-EACCES, "no permission to call method %u on %u", msg->opcode, msg->id);
|
||||
-EACCES, "no permission to call method %u on %u (requires %08x, have %08x)",
|
||||
msg->opcode, msg->id, required, permissions);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -218,20 +215,17 @@ done:
|
|||
return res;
|
||||
|
||||
invalid_method:
|
||||
pw_log_error(NAME" %p: invalid method id:%u op:%u",
|
||||
client->protocol, msg->id, msg->opcode);
|
||||
pw_resource_errorf(resource, res, "invalid method id:%u op:%u",
|
||||
msg->id, msg->opcode);
|
||||
goto done;
|
||||
invalid_message:
|
||||
pw_log_error(NAME" %p: invalid message received id:%u op:%u (%s)",
|
||||
client->protocol, msg->id, msg->opcode, spa_strerror(res));
|
||||
pw_resource_errorf(resource, res, "invalid message received id:%u op:%u (%s)",
|
||||
msg->id, msg->opcode, spa_strerror(res));
|
||||
debug_msg("*invalid message*", msg, true);
|
||||
goto done;
|
||||
error:
|
||||
pw_log_error(NAME" %p: client error (%s)", client->protocol, spa_strerror(res));
|
||||
pw_resource_errorf(client->core_resource, res, "client error %d (%s)",
|
||||
res, spa_strerror(res));
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +352,7 @@ static struct client_data *client_new(struct server *s, int fd)
|
|||
#ifndef __FreeBSD__
|
||||
len = sizeof(ucred);
|
||||
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) {
|
||||
pw_log_error("server %p: no peercred: %m", s);
|
||||
pw_log_warn("server %p: no peercred: %m", s);
|
||||
} else {
|
||||
pw_properties_setf(props, PW_KEY_SEC_PID, "%d", ucred.pid);
|
||||
pw_properties_setf(props, PW_KEY_SEC_UID, "%d", ucred.uid);
|
||||
|
|
@ -668,7 +662,7 @@ process_remote(struct client *impl)
|
|||
pw_proxy_unref(proxy);
|
||||
|
||||
if (res < 0) {
|
||||
pw_log_error (NAME" %p: invalid message received %u for %u",
|
||||
pw_log_error(NAME" %p: invalid message received %u for %u",
|
||||
this, msg->opcode, msg->id);
|
||||
debug_msg("*invalid*", msg, true);
|
||||
continue;
|
||||
|
|
@ -709,7 +703,7 @@ on_remote_data(void *data, int fd, uint32_t mask)
|
|||
}
|
||||
return;
|
||||
error:
|
||||
pw_log_error(NAME" %p: got connection error %d (%s)", impl, res, spa_strerror(res));
|
||||
pw_log_debug(NAME" %p: got connection error %d (%s)", impl, res, spa_strerror(res));
|
||||
pw_proxy_notify((struct pw_proxy*)this,
|
||||
struct pw_core_events, error, 0, 0,
|
||||
this->recv_seq, res, "connection error");
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ uint32_t pw_protocol_native_connection_add_fd(struct pw_protocol_native_connecti
|
|||
|
||||
index = buf->msg.n_fds;
|
||||
if (index + buf->n_fds >= MAX_FDS) {
|
||||
pw_log_error("connection %p: too many fds", conn);
|
||||
pw_log_error("connection %p: too many fds (%d)", conn, MAX_FDS);
|
||||
return SPA_IDX_INVALID;
|
||||
}
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ static int refill_buffer(struct pw_protocol_native_connection *conn, struct buff
|
|||
|
||||
/* ERRORS */
|
||||
recv_error:
|
||||
pw_log_error("could not recvmsg on fd:%d: %s", conn->fd, strerror(errno));
|
||||
pw_log_error("connection %p: could not recvmsg on fd:%d: %m", conn, conn->fd);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -648,7 +648,7 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
|
|||
return pw_resource_notify(resource, struct pw_core_methods, destroy, 0, r);
|
||||
|
||||
no_resource:
|
||||
pw_log_error("client %p: unknown resouce %u op:%u", client, id, msg->opcode);
|
||||
pw_log_debug("client %p: unknown resouce %u op:%u", client, id, msg->opcode);
|
||||
pw_resource_errorf(resource, -EINVAL, "unknown resource %d op:%u", id, msg->opcode);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue