Leosac  0.8.0
Open Source Access Control
leosacexception.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
26 #ifndef LEOSACEXCEPTION_HPP
27 #define LEOSACEXCEPTION_HPP
28 
29 #include "tools/Stacktrace.hpp"
30 #include <cstddef>
31 #include <exception>
32 #include <string>
33 
40 class LEOSACException : public std::exception
41 {
42  public:
43  explicit LEOSACException(const std::string &message)
44  : message_(message)
45  , trace_(2) // Skip 2 frames. The LeosacException ctor and Stacktrace ctor.
46  {
47  }
48 
49  virtual ~LEOSACException()
50  {
51  }
52 
53  virtual const char *what() const noexcept final
54  {
55  return (message_.c_str());
56  }
57 
62  {
63  return trace_;
64  }
65 
66  protected:
67  std::string message_;
68 
69  private:
71 };
72 
73 #include "configexception.hpp"
74 #include "coreexception.hpp"
75 #include "deviceexception.hpp"
76 #include "dynlibexception.hpp"
77 #include "fsexception.hpp"
78 #include "gpioexception.hpp"
79 #include "moduleexception.hpp"
80 #include "scriptexception.hpp"
81 #include "signalexception.hpp"
82 
83 #endif // LEOSACEXCEPTION_HPP
LEOSACException::what
virtual const char * what() const noexcept final
Definition: leosacexception.hpp:53
LEOSACException::~LEOSACException
virtual ~LEOSACException()
Definition: leosacexception.hpp:49
Stacktrace.hpp
LEOSACException::trace
const Leosac::Tools::Stacktrace & trace() const
Get the stacktrace associated with this exception.
Definition: leosacexception.hpp:61
dynlibexception.hpp
Exception class for DynLib related errors.
gpioexception.hpp
Exception class for Gpio related errors.
LEOSACException::message_
std::string message_
Definition: leosacexception.hpp:67
moduleexception.hpp
Exception class for modules.
deviceexception.hpp
Exception class for Device related errors.
Leosac::Tools::Stacktrace
Store information about a stacktrace at a given point in the program execution.
Definition: Stacktrace.hpp:42
signalexception.hpp
Exception class for Signal related errors.
LEOSACException
A base class for Leosac specific exception.
Definition: leosacexception.hpp:40
LEOSACException::trace_
Leosac::Tools::Stacktrace trace_
Definition: leosacexception.hpp:70
configexception.hpp
fsexception.hpp
Exception class for filesystem related errors.
scriptexception.hpp
Exception class for Script related errors.
LEOSACException::LEOSACException
LEOSACException(const std::string &message)
Definition: leosacexception.hpp:43
coreexception.hpp
Exception class for Core related errors.