Exception: make source location print-out optional
[lttng-tools.git] / src / common / exception.cpp
CommitLineData
53cd1e22
JG
1/*
2 * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#include "exception.hpp"
28ab034a 9
53cd1e22
JG
10#include <common/error.hpp>
11
28ab034a
JG
12#include <sstream>
13
0038180d
JG
14lttng::ctl::error::error(const std::string& msg,
15 lttng_error_code error_code,
9f4d1ef3
JG
16 const lttng::source_location& location) :
17 runtime_error(msg, location), _error_code{ error_code }
53cd1e22
JG
18{
19}
20
baac5795 21lttng::posix_error::posix_error(const std::string& msg,
9f4d1ef3
JG
22 unsigned int errno_code,
23 const lttng::source_location& location) :
24 std::system_error(errno_code, std::generic_category()),
25 lttng::runtime_error(msg, location)
53cd1e22
JG
26{
27}
aeeb48c6 28
baac5795 29lttng::runtime_error::runtime_error(const std::string& msg,
9f4d1ef3
JG
30 const lttng::source_location& location) :
31 std::runtime_error(msg), source_location(location)
aeeb48c6
JG
32{
33}
baac5795 34
b6bbb1d6 35lttng::unsupported_error::unsupported_error(const std::string& msg,
9f4d1ef3
JG
36 const lttng::source_location& location) :
37 lttng::runtime_error(msg, location)
b6bbb1d6
JG
38{
39}
40
baac5795 41lttng::communication_error::communication_error(const std::string& msg,
9f4d1ef3
JG
42 const lttng::source_location& location) :
43 runtime_error(msg, location)
baac5795
JG
44{
45}
46
47lttng::protocol_error::protocol_error(const std::string& msg,
9f4d1ef3
JG
48 const lttng::source_location& location) :
49 communication_error(msg, location)
baac5795
JG
50{
51}
52
53lttng::invalid_argument_error::invalid_argument_error(const std::string& msg,
9f4d1ef3
JG
54 const lttng::source_location& location) :
55 runtime_error(msg, location)
baac5795
JG
56{
57}
This page took 0.041713 seconds and 4 git commands to generate.