Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
CommonException.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <exception>
9#include <ostream>
10
11#include <alib/string>
12
13namespace exception {
14
21class CommonException : public std::exception {
22private:
27 std::string m_cause;
28
33 std::string m_backtrace;
34
39 std::string m_command;
40
41public:
46 explicit CommonException ( std::string cause );
47
51 const char * what ( ) const noexcept override;
52
56 const std::string & getCause ( ) const;
57
61 const std::string & getBacktrace ( ) const;
62
66 const std::string & getCommand ( ) const;
67
76 friend std::ostream & operator <<( std::ostream & os, const CommonException & );
77};
78
79} /* namespace exception */
80
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
CommonException(std::string cause)
Exception constructor with specified cause. The backtrace is internally computed and the command line...
Definition: CommonException.cpp:20
const char * what() const noexcept override
Definition: CommonException.cpp:35
const std::string & getCommand() const
Definition: CommonException.cpp:47
friend std::ostream & operator<<(std::ostream &os, const CommonException &)
Definition: CommonException.cpp:51
const std::string & getCause() const
Definition: CommonException.cpp:39
const std::string & getBacktrace() const
Definition: CommonException.cpp:43
Definition: CommonException.cpp:18