-
Notifications
You must be signed in to change notification settings - Fork 1
/
RedisError.h
55 lines (39 loc) · 883 Bytes
/
RedisError.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef REDISERROR_H
#define REDISERROR_H
#include "RedisType.h"
namespace Redis {
class Error
{
public:
Error();
Error(const std::string& message);
virtual ~Error();
const std::string& getMessage() const;
void setMessage(const std::string& message);
private:
std::string _message;
};
inline const std::string& Error::getMessage() const
{
return _message;
}
inline void Error::setMessage(const std::string& message)
{
_message = message;
}
template<>
struct RedisTypeTraits<Error>
{
enum { TypeId = RedisType::REDIS_ERROR };
static const char marker = '-';
static std::string toString(const Error& value)
{
return marker + value.getMessage() + "\r\n";
}
static void read(RedisInputStream& input, Error& value)
{
value.setMessage(input.getline().c_str());
}
};
}
#endif // REDISERROR_H