src.ctf.fs: improve `metadata-info` query error message with non-existent metadata file
A colleague pointed out that the message babeltrace2 outputs when
pointing the `metadata-info` query to a directory without a metadata
file (or a non-existent directory) is not clear as it could be.
ERROR: [Babeltrace CLI] (/home/smarchi/src/babeltrace/src/cli/babeltrace2.c:651)
Failed to query component class: unknown error: plugin-name="ctf", comp-cls-name="fs", comp-cls-type=SOURCE object="metadata-info"
CAUSED BY [libbabeltrace2] (/home/smarchi/src/babeltrace/src/lib/graph/query-executor.c:234)
Component class's "query" method failed: query-exec-addr=0x60b000000880, cc-addr=0x60f000000130, cc-type=SOURCE, cc-name="fs", cc-partial-descr="Read CTF traces from the file sy",
cc-is-frozen=0, cc-so-handle-addr=0x607000000020, cc-so-handle-path="/home/smarchi/build/babeltrace/src/plugins/ctf/babeltrace-plugin-ctf.la", object="metadata-info",
params-addr=0x606000000500, params-type=MAP, params-element-count=1, log-level=WARNING
CAUSED BY ['source.ctf.fs'] (/home/smarchi/src/babeltrace/src/plugins/ctf/fs-src/query.cpp:92)
Cannot open trace metadata: path="yoyoyo".
In the ctf_fs_metadata_open_file function, we could have access to the
errno that explains the failure, but currently don't use it. Also, it
would be good to tell which file we tried to open exactly. Make
ctf_fs_metadata_open_file log an error and append an error cause.
The new error stack is the same as the above, with this new cause at the
end:
CAUSED BY ['source.ctf.fs'] (/home/smarchi/src/babeltrace/src/plugins/ctf/fs-src/metadata.cpp:41)
Failed to open metadata file: No such file or directory: path="yoyoyo/metadata"
Add a test that validates that this error cause is present in the error
message.
Change-Id: I111848cc72e6f3b2cdfb251914eb337ea02a19f4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11079
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
This page took 0.02502 seconds and 4 git commands to generate.