R3BROOT
R3B analysis software
Toggle main menu visibility
Loading...
Searching...
No Matches
R3BException.cxx
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) 2023 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3
* Copyright (C) 2023-2026 Members of R3B Collaboration *
4
* *
5
* This software is distributed under the terms of the *
6
* GNU General Public Licence (GPL) version 3, *
7
* copied verbatim in the file "LICENSE". *
8
* *
9
* In applying this license GSI does not waive the privileges and immunities *
10
* granted to it by virtue of its status as an Intergovernmental Organization *
11
* or submit itself to any jurisdiction. *
12
******************************************************************************/
13
14
#include "
R3BException.h
"
15
#include <filesystem>
16
#include <fmt/color.h>
17
#include <fmt/core.h>
18
19
namespace
fs = std::filesystem;
20
21
namespace
22
{
23
std::string Print_msg_with_loc(
const
std::string& err,
const
boost::source_location& loc)
24
{
25
auto
filepath = fs::path{ loc.file_name() };
26
return
fmt::format(fmt::emphasis::bold | fg(fmt::color::red),
27
"{}:{}:{}: {}"
,
28
filepath.filename().string(),
29
loc.line(),
30
loc.function_name(),
31
err);
32
}
33
34
}
// namespace
35
namespace
R3B
36
{
37
38
runtime_error::runtime_error
(
const
std::string& err,
const
boost::source_location& loc)
39
: std::
runtime_error
{ Print_msg_with_loc(err, loc) }
40
{
41
}
42
43
logic_error::logic_error
(
const
std::string& err,
const
boost::source_location& loc)
44
: std::
logic_error
{ Print_msg_with_loc(err, loc) }
45
{
46
}
47
}
// namespace R3B
R3BException.h
R3B::logic_error::logic_error
logic_error(const std::string &err, const boost::source_location &loc=BOOST_CURRENT_LOCATION)
Definition
R3BException.cxx:43
R3B::runtime_error::runtime_error
runtime_error(const std::string &err, const boost::source_location &loc=BOOST_CURRENT_LOCATION)
Definition
R3BException.cxx:38
R3B
Definition
R3BNeulandAnalysisApp.cxx:44
r3bbase
R3BException.cxx
Generated by
1.18.0