lib: remove INVALID_PARAMS status
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 24 Jul 2019 03:54:13 +0000 (23:54 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 7 Aug 2019 18:05:19 +0000 (14:05 -0400)
commit574dea6878f863ffbaa9075b300ade7be78f80c8
tree17f026f9f01f0915e8a3c1f8ce284b830f982bcf
parent35d7d893ddfc4cedbf6b625ddad7f4f90681fb78
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.026772 seconds and 4 git commands to generate.