Add basic exception types and throwing facilities
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 29 Apr 2022 19:43:14 +0000 (15:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 13 Jun 2022 20:34:46 +0000 (16:34 -0400)
commit53cd1e2272afac08649dc55e395ec8a5dac20b4e
treeb9693d449ff9b3cccfe06d5aab2fd4379df86839
parent47aa4f7bc50412db0818c83136814a9a1a0edf9a
Add basic exception types and throwing facilities

Add two LTTng-specific exception types:
  - lttng::ctl::error
  - lttng::posix_error

These types are meant to help transition from error code-based
error handling in RAII-safe functions.

lttng::ctl::error wraps `enum lttng_error_code`. It is meant to be
thrown using the `LTTNG_THROW_CTL` macro which samples the throw-site
(file name, function name, line number). This should be used only
in code paths dealing providing the liblttng-ctl interface.

It should, ultimately, be thrown in code that is specific to the
implementation of the various liblttng-ctl commands and not all over the
place since it contains very little information beyond the error code.

lttng::posix_error wraps `errno` values that are used in various places
to report errors involving (mostly) syscalls.

Over time, more specific exception types will be added.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I02e104f28dd8149aee70211b5849f3502f16d58b
src/common/Makefile.am
src/common/exception.cpp [new file with mode: 0644]
src/common/exception.hpp [new file with mode: 0644]
This page took 0.026354 seconds and 5 git commands to generate.