iodrivers_base
src
Exceptions.hpp
Go to the documentation of this file.
1
#ifndef IODRIVERS_BASE_EXCEPTIONS_HPP
2
#define IODRIVERS_BASE_EXCEPTIONS_HPP
3
4
#include <string>
5
#include <stdexcept>
6
#include <exception>
7
8
namespace
iodrivers_base
9
{
10
13
struct
UnixError
: std::runtime_error
14
{
15
int
const
error
;
16
explicit
UnixError
(std::string
const
& desc);
17
18
UnixError
(std::string
const
& desc,
int
error_code);
19
};
20
22
struct
TimeoutError
: std::runtime_error
23
{
24
enum
TIMEOUT_TYPE
25
{ NONE,
PACKET
, FIRST_BYTE };
26
27
TIMEOUT_TYPE
type
;
28
29
explicit
TimeoutError
(
TIMEOUT_TYPE
type, std::string
const
& desc)
30
:
std
::runtime_error(desc)
31
, type(type) {}
32
};
33
34
}
35
class
MockContextException
:
public
std::exception
36
{
37
public
:
38
const
char
*
what
()
const
throw()
39
{
40
return
"IODRIVERS_BASE_MOCK Error: Expectation set outside Mock Context! Please call IODRIVERS_BASE_MOCK() before setting expectations"
;
41
}
42
};
43
44
class
TestEndsWithExpectationsLeftException
:
public
std::exception
45
{
46
public
:
47
const
char
*
what
()
const
throw()
48
{
49
return
"IODRIVERS_BASE_MOCK Error: Test reached its end without satisfying all expecations"
;
50
}
51
};
52
53
#endif
54
iodrivers_base::UnixError::UnixError
UnixError(std::string const &desc)
Definition:
Exceptions.cpp:7
iodrivers_base::TimeoutError::type
TIMEOUT_TYPE type
Definition:
Exceptions.hpp:27
iodrivers_base::UnixError::error
int const error
Definition:
Exceptions.hpp:15
std
iodrivers_base
Definition:
Bus.hpp:9
MockContextException
Definition:
Exceptions.hpp:35
iodrivers_base::TimeoutError::PACKET
Definition:
Exceptions.hpp:25
iodrivers_base::UnixError
Definition:
Exceptions.hpp:13
TestEndsWithExpectationsLeftException
Definition:
Exceptions.hpp:44
MockContextException::what
const char * what() const
Definition:
Exceptions.hpp:38
TestEndsWithExpectationsLeftException::what
const char * what() const
Definition:
Exceptions.hpp:47
iodrivers_base::TimeoutError::TIMEOUT_TYPE
TIMEOUT_TYPE
Definition:
Exceptions.hpp:24
iodrivers_base::TimeoutError
Definition:
Exceptions.hpp:22
iodrivers_base::TimeoutError::TimeoutError
TimeoutError(TIMEOUT_TYPE type, std::string const &desc)
Definition:
Exceptions.hpp:29
Generated by
1.8.13