mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-12 13:30:15 -05:00
improve error handling
This commit is contained in:
parent
c30d938034
commit
5850044599
6 changed files with 45 additions and 15 deletions
|
|
@ -107,6 +107,11 @@ int main(int argc, char *argv[])
|
|||
PW_KEY_CORE_DAEMON, "1", NULL),
|
||||
0);
|
||||
|
||||
if (core == NULL) {
|
||||
pw_log_error("failed to create core: %m");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pw_daemon_config_run_commands(config, core) < 0) {
|
||||
pw_log_error("failed to run config commands");
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -74,12 +74,14 @@ struct pw_data_loop *pw_data_loop_new(struct pw_properties *properties)
|
|||
|
||||
this->loop = pw_loop_new(properties);
|
||||
if (this->loop == NULL) {
|
||||
pw_log_debug("data-loop %p: can't create loop: %m", this);
|
||||
res = -errno;
|
||||
goto no_loop;
|
||||
}
|
||||
|
||||
this->event = pw_loop_add_event(this->loop, do_stop, this);
|
||||
if (this->event == NULL) {
|
||||
pw_log_debug("data-loop %p: can't add event: %m", this);
|
||||
res = -errno;
|
||||
goto no_event;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ struct pw_loop *pw_loop_new(struct pw_properties *properties)
|
|||
if ((res = spa_handle_get_interface(impl->system_handle,
|
||||
SPA_TYPE_INTERFACE_System,
|
||||
&iface)) < 0) {
|
||||
fprintf(stderr, "can't get System interface %d\n", res);
|
||||
pw_log_error("can't get System interface %d\n", res);
|
||||
goto out_free_system;
|
||||
}
|
||||
this->system = iface;
|
||||
|
|
@ -104,18 +104,10 @@ struct pw_loop *pw_loop_new(struct pw_properties *properties)
|
|||
n_support, support);
|
||||
if (impl->loop_handle == NULL) {
|
||||
res = -errno;
|
||||
pw_log_error("can't make loop handle");
|
||||
pw_log_error("can't make loop handle: %m");
|
||||
goto out_free_system;
|
||||
}
|
||||
|
||||
if ((res = spa_handle_get_interface(impl->system_handle,
|
||||
SPA_TYPE_INTERFACE_System,
|
||||
&iface)) < 0) {
|
||||
fprintf(stderr, "can't get System interface %d\n", res);
|
||||
goto out_free_loop;
|
||||
}
|
||||
this->system = iface;
|
||||
|
||||
if ((res = spa_handle_get_interface(impl->loop_handle,
|
||||
SPA_TYPE_INTERFACE_Loop,
|
||||
&iface)) < 0) {
|
||||
|
|
|
|||
|
|
@ -256,7 +256,8 @@ struct spa_handle *pw_load_spa_handle(const char *lib,
|
|||
if ((res = spa_handle_factory_init(factory,
|
||||
&handle->handle, info,
|
||||
support, n_support)) < 0) {
|
||||
pw_log_warn("can't make factory instance %s: %d\n", factory_name, res);
|
||||
pw_log_warn("can't make factory instance '%s': %d (%s)",
|
||||
factory_name, res, spa_strerror(res));
|
||||
goto out_free_handle;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue