exception_cpe.hpp
Go to the documentation of this file.
1 /*
2 ** TP CPE Lyon
3 ** Copyright (C) 2014 Damien Rohmer
4 **
5 ** This program is free software: you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation, either version 3 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 
21 
22 #ifndef EXCEPTION_CPE_HPP
23 #define EXCEPTION_CPE_HPP
24 
25 #include <iostream>
26 #include <string>
27 #include "backtrace.hpp"
28 
29 #define MACRO_EXCEPTION_PARAMETER __FILE__,__FUNCTION__,__LINE__,cpe::get_backtrace()
30 
31 
33 namespace cpe
34 {
35 
36 
39  {
40  public:
41 
43  exception_cpe();
45  exception_cpe(const std::string& msg,const std::string& file,const std::string& caller,const int& line,const std::string& backtrace_arg);
46 
48  std::string info() const;
49 
51  std::string info_backtrace() const;
52 
54  std::string report_exception() const;
55 
56  private:
57 
59  std::string message;
61  std::string caller;
63  std::string file;
65  std::string line;
67  std::string backtrace_msg;
68 
69  };
70 }
71 
72 #endif
General exception class.
Definition: exception_cpe.hpp:38
std::string backtrace_msg
backtrace error message
Definition: exception_cpe.hpp:67
std::string line
error line storage
Definition: exception_cpe.hpp:65
std::string report_exception() const
export exception informations
Definition: exception_cpe.cpp:48
std::string info_backtrace() const
get backtrace
Definition: exception_cpe.cpp:43
exception_cpe()
empty constructor
Definition: exception_cpe.cpp:26
std::string caller
caller name storage
Definition: exception_cpe.hpp:61
std::string file
file name storage
Definition: exception_cpe.hpp:63
std::string info() const
return error message
Definition: exception_cpe.cpp:37
std::string message
error message storage
Definition: exception_cpe.hpp:59