Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
exception.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <stdexcept>
5#include <string>
6
7// HACK: Clang 14 does not support std::source_location.
8#if defined(__clang__) && __clang_major__ <= 14
9#include <experimental/source_location>
10using std::experimental::source_location;
11#else
12#include <source_location>
13using std::source_location;
14#endif // defined(__clang__) && __clang_major__ <= 14
15
16namespace hgps::core {
17
19class HgpsException : public std::runtime_error {
20 public:
24 HgpsException(const std::string &what_arg,
25 const source_location location = source_location::current());
26
29 constexpr std::uint_least32_t line() const noexcept;
30
33 constexpr std::uint_least32_t column() const noexcept;
34
37 constexpr const char *file_name() const noexcept;
38
41 constexpr const char *function_name() const noexcept;
42
43 private:
44 source_location location_;
45};
46
47} // namespace hgps::core
HealthGPS base exception class, with source location information.
Definition exception.h:19
constexpr std::uint_least32_t line() const noexcept
Gets the exception source location line.
Definition exception.cpp:11
constexpr const char * file_name() const noexcept
Gets the exception source location file name.
Definition exception.cpp:15
constexpr std::uint_least32_t column() const noexcept
Gets the exception source location column.
Definition exception.cpp:13
constexpr const char * function_name() const noexcept
Gets the exception source location function name.
Definition exception.cpp:17
Top-level namespace for Health-GPS Core C++ API.
Definition analysis.h:7