-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIncompatibleValueTypeException.cpp
More file actions
64 lines (54 loc) · 1.42 KB
/
IncompatibleValueTypeException.cpp
File metadata and controls
64 lines (54 loc) · 1.42 KB
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
56
57
58
59
60
61
62
63
64
#include <sstream>
#include "IncompatibleValueTypeException.h"
using libreg::IncompatibleValueTypeException;
using libreg::MultiString;
using libreg::SyscallFailure;
using libreg::ValueType;
IncompatibleValueTypeException::IncompatibleValueTypeException(libreg::Hive hive,
const MultiString& path,
ValueType expected,
ValueType actual,
const SyscallFailure& inner)
: _hive(hive),
_path(path),
_inner(inner),
_expected(expected),
_actual(actual),
_message(BuildMessage(hive, path, expected, actual, inner))
{
}
const char* IncompatibleValueTypeException::what() const noexcept
{
return _message.c_str();
}
const MultiString& IncompatibleValueTypeException::Path() const
{
return _path;
}
libreg::Hive IncompatibleValueTypeException::Hive() const
{
return _hive;
}
const SyscallFailure& IncompatibleValueTypeException::Inner() const
{
return _inner;
}
ValueType IncompatibleValueTypeException::Expected() const
{
return _expected;
}
ValueType IncompatibleValueTypeException::Actual() const
{
return _actual;
}
std::string IncompatibleValueTypeException::BuildMessage(libreg::Hive hive,
const MultiString& path,
ValueType expected,
ValueType actual,
const SyscallFailure& inner)
{
std::stringstream str;
str << "Incompatible value type when accessing value: \"" << hive << "\\" << path
<< ". Expected: " << _expected << ", actual: " << _actual << ", details: " << inner.what();
return str.str();
}