RobotTestingFramework 2.0.1
Robot Testing Framework
Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1/*
2 * Robot Testing Framework
3 *
4 * Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21
22#ifndef ROBOTTESTINGFRAMEWORK_EXCEPTION_H
23#define ROBOTTESTINGFRAMEWORK_EXCEPTION_H
24
26
27#include <exception>
28
29namespace robottestingframework {
30
34class Exception : public std::exception
35{
36
37public:
38 Exception(const Exception& other) :
39 std::exception(other),
42 {
43 }
44
45 Exception(const TestMessage& msg) :
46 expMessage(msg)
47 {
49 if (expMessage.getDetail().size())
50 strMessage += "(" + expMessage.getDetail() + ")";
51 }
52
53 virtual ~Exception() throw()
54 {
55 }
56
61 const char* what() const throw() override
62 {
63 return strMessage.c_str();
64 }
65
72 {
73 return expMessage;
74 }
75
76private:
78 std::string strMessage;
79};
80
81
87{
88public:
90 Exception(msg)
91 {
92 }
93
95 Exception(other)
96 {
97 }
98};
99
100
107{
108public:
110 Exception(msg)
111 {
112 }
113
115 Exception(other)
116 {
117 }
118};
119
120
127{
128public:
130 Exception(msg)
131 {
132 }
133
135 Exception(other)
136 {
137 }
138};
139
140} // namespace robottestingframework
141
142#endif // ROBOTTESTINGFRAMEWORK_EXCEPTION_H
The Exception is a generic exception.
Definition Exception.h:35
Exception(const Exception &other)
Definition Exception.h:38
const TestMessage & message()
message
Definition Exception.h:71
Exception(const TestMessage &msg)
Definition Exception.h:45
const char * what() const override
what
Definition Exception.h:61
The FixtureException class Ficture exception is used when a there is a probleme during fixture setup.
Definition Exception.h:127
FixtureException(const TestMessage &msg)
Definition Exception.h:129
FixtureException(const FixtureException &other)
Definition Exception.h:134
The TestErrorException class Error exception is used when test breakdown due to an error in setup,...
Definition Exception.h:107
TestErrorException(const TestMessage &msg)
Definition Exception.h:109
TestErrorException(const TestErrorException &other)
Definition Exception.h:114
The FailureException class Failure exception is used when a test or subtests fail.
Definition Exception.h:87
TestFailureException(const TestMessage &msg)
Definition Exception.h:89
TestFailureException(const TestFailureException &other)
Definition Exception.h:94
A formated message with details.
Definition TestMessage.h:33
std::string getMessage()
getMessage returns the message string
std::string getDetail()
getMessage returns the detail string