algorithms
2.2.0
Framework-independent algorithms for the EIC
Toggle main menu visibility
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: LGPL-3.0-or-later
2
// Copyright (C) 2022 Wouter Deconinck, Sylvester Joosten
3
//
4
// A simple exception base class that transports both an error message and error type
5
6
#pragma once
7
8
#include <exception>
9
#include <string>
10
11
namespace
algorithms
{
12
13
class
Error
:
public
std::exception {
14
public
:
15
Error
(std::string_view msg, std::string_view
type
=
"algorithms::Error"
)
16
: m_msg{msg}, m_type{
type
} {}
17
18
virtual
const
char
*
what
() const noexcept {
return
m_msg.c_str(); }
19
virtual
const
char
*
type
() const noexcept {
return
m_type.c_str(); }
20
virtual
~Error
() noexcept {}
21
22
private
:
23
const
std::string m_msg;
24
const
std::string m_type;
25
};
26
27
}
// namespace algorithms
28
algorithms::Error::Error
Error(std::string_view msg, std::string_view type="algorithms::Error")
Definition
error.h:15
algorithms::Error::type
virtual const char * type() const noexcept
Definition
error.h:19
algorithms::Error::what
virtual const char * what() const noexcept
Definition
error.h:18
algorithms::Error::~Error
virtual ~Error() noexcept
Definition
error.h:20
algorithms
Definition
algorithm.h:52
core
include
algorithms
error.h
Generated by
1.17.0