Make error handling more understandable

Closes: #284
Approved by: alexlarsson
auto
Seppo Yli-Olli 2019-06-07 19:07:02 +03:00 committed by Atomic Bot
parent 30581bf63a
commit cd1923a776
1 changed files with 13 additions and 7 deletions

View File

@ -3834,6 +3834,7 @@ builder_manifest_install_dep (BuilderManifest *self,
{ {
g_autofree char *ref = NULL; g_autofree char *ref = NULL;
g_autofree char *commit = NULL; g_autofree char *commit = NULL;
g_autoptr(GError) first_error = NULL;
if (version == NULL) if (version == NULL)
version = builder_manifest_get_runtime_version (self); version = builder_manifest_get_runtime_version (self);
@ -3869,17 +3870,22 @@ builder_manifest_install_dep (BuilderManifest *self,
if (builder_manifest_install_single_dep (ref, remote, opt_user, opt_installation, if (builder_manifest_install_single_dep (ref, remote, opt_user, opt_installation,
&current_error)) &current_error))
{ {
current_error = g_steal_pointer(error);
return TRUE; return TRUE;
} }
else if (*error == NULL) else {
{ gboolean fatal_error = current_error->domain != G_SPAWN_EXIT_ERROR;
*error = g_steal_pointer(&current_error); if (first_error == NULL)
} {
if ((*error)->domain != G_SPAWN_EXIT_ERROR) first_error = g_steal_pointer(&current_error);
return FALSE; }
if (fatal_error)
{
break;
}
}
} }
} }
*error = g_steal_pointer(&first_error);
return FALSE; return FALSE;
} }