lib: remove INVALID_PARAMS status
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 24 Jul 2019 03:54:13 +0000 (23:54 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 24 Jul 2019 17:39:42 +0000 (13:39 -0400)
commita635e50750a3c1e8907b38c8311dc0b8bb0f09c3
treeada8c607a8ba11feb7b69b1924f8c9d87531eaee
parentaede8fc9160e48cc3bc6803c8c337e1a5b6a364c
lib: remove INVALID_PARAMS status

This patch removes the INVALID_PARAMS status.  It is currently meant to
be used by component classes in query, if they don't get the parameters
they expect (mandatory parameter not present, wrong type, wrong value).

Since we now have a framework to describe errors precisely, this can be
accomplished more simply by returning ERROR and appending an error
cause.

So this patch removes INVALID_PARAMS, replacing all of its uses with
ERROR.  It also remove other traces of that status, including in the
Python bindings.

- In lttng-live.c, we were logging a warning when getting invalid
parameters.  Since we are now returning an error, I think it makes sense
to log an error.  I also think it's something that deserves to be an
error anyway.

- Because queries now return ERROR without appending an error cause and
the library's bt_query_executor_query function doesn't append either, we
get in the case where we construct a bt2._Error and don't have an error
for the current thread.  I added some error cause appending in
bt_query_executor_query to fix that, which I think is a valid
improvement on its own.  Component classes should ideally also append an
error cause when they return ERROR, but that is left as an exercise for
later.

- The test_query_invalid_params test is removed.  Changing raise
bt2.InvalidParams to raise ValueError would just make the test redundant
with test_query_gen_error.

Change-Id: I8c9277aa5e55bb8cde9b23a3aedf217cbe6a5849
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1756
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
15 files changed:
include/babeltrace2/babeltrace.h
include/babeltrace2/func-status.h
include/babeltrace2/graph/component-class.h
include/babeltrace2/graph/query-executor.h
src/bindings/python/bt2/bt2/__init__.py.in
src/bindings/python/bt2/bt2/native_bt_component_class.i
src/bindings/python/bt2/bt2/utils.py
src/cli/babeltrace2.c
src/common/common.h
src/lib/func-status.h
src/lib/graph/query-executor.c
src/plugins/ctf/fs-src/query.c
src/plugins/ctf/lttng-live/lttng-live.c
tests/bindings/python/bt2/test_query_executor.py
tests/plugins/src.ctf.fs/query/test_query_trace_info.py
This page took 0.025736 seconds and 4 git commands to generate.