Skip to content

Commit cd1923a

Browse files
nanonymerh-atomic-bot
authored andcommitted
Make error handling more understandable
Closes: #284 Approved by: alexlarsson
1 parent 30581bf commit cd1923a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/builder-manifest.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,6 +3834,7 @@ builder_manifest_install_dep (BuilderManifest *self,
38343834
{
38353835
g_autofree char *ref = NULL;
38363836
g_autofree char *commit = NULL;
3837+
g_autoptr(GError) first_error = NULL;
38373838

38383839
if (version == NULL)
38393840
version = builder_manifest_get_runtime_version (self);
@@ -3869,17 +3870,22 @@ builder_manifest_install_dep (BuilderManifest *self,
38693870
if (builder_manifest_install_single_dep (ref, remote, opt_user, opt_installation,
38703871
&current_error))
38713872
{
3872-
current_error = g_steal_pointer(error);
38733873
return TRUE;
38743874
}
3875-
else if (*error == NULL)
3876-
{
3877-
*error = g_steal_pointer(&current_error);
3878-
}
3879-
if ((*error)->domain != G_SPAWN_EXIT_ERROR)
3880-
return FALSE;
3875+
else {
3876+
gboolean fatal_error = current_error->domain != G_SPAWN_EXIT_ERROR;
3877+
if (first_error == NULL)
3878+
{
3879+
first_error = g_steal_pointer(&current_error);
3880+
}
3881+
if (fatal_error)
3882+
{
3883+
break;
3884+
}
3885+
}
38813886
}
38823887
}
3888+
*error = g_steal_pointer(&first_error);
38833889
return FALSE;
38843890
}
38853891

0 commit comments

Comments
 (0)