enhance error handling in frontend commands

This commit is contained in:
2025-06-23 13:42:21 +01:00
parent 5fa6421f6c
commit ccea64ef7d
2 changed files with 14 additions and 4 deletions

View File

@@ -287,6 +287,7 @@ static enum ec3_status capture_directory(
vnode.v_id = ctx->ctx_tree.fs_root->n_id;
ec3_volume_put_vnode(volume, &vnode);
enum ec3_status status2 = EC3_SUCCESS;
b_directory_iterator it;
b_directory_iterator_begin(dir, &it, B_DIRECTORY_ITERATE_PARENT_LAST);
while (b_directory_iterator_is_valid(&it)) {
@@ -300,7 +301,7 @@ static enum ec3_status capture_directory(
printf("file: %s\n", b_path_ptr(it.filepath));
enum ec3_status status2 = capture_file(
status2 = capture_file(
ctx,
volume,
dir,
@@ -334,7 +335,7 @@ static enum ec3_status capture_directory(
ec3_tag_ioctx_close(volu);
b_directory_release(dir);
return EC3_SUCCESS;
return status2;
}
static int capture(

View File

@@ -65,7 +65,9 @@ static enum ec3_status collect_children(
&chunk);
if (status != EC3_SUCCESS) {
b_err("cannot read chunk.");
char tmp[64];
ec3_chunk_id_to_string(parent->i_vnode.v_data, tmp, sizeof tmp);
b_err("cannot read chunk %s.", tmp);
return status;
}
@@ -98,11 +100,18 @@ static enum ec3_status collect_children(
child->i_name = b_string_steal(ctx->ctx_str);
child->i_depth = parent->i_depth + 1;
ec3_volume_get_vnode(
status = ec3_volume_get_vnode(
ctx->ctx_volume,
vnode_id,
&child->i_vnode);
if (status != EC3_SUCCESS) {
b_err("cannot find vnode %lu (child of %s)",
vnode_id,
parent->i_name);
return status;
}
b_queue_insert_after(
&ctx->ctx_stack,
&child->i_entry,