File: exceptions.cpp

package info (click to toggle)
drbd-utils 9.22.0-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,768 kB
  • sloc: ansic: 48,975; xml: 11,553; cpp: 9,843; sh: 4,568; makefile: 1,029; perl: 353; ruby: 43
file content (123 lines) | stat: -rw-r--r-- 2,953 bytes parent folder | download | duplicates (4)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include <exceptions.h>

//@throws std::bad_alloc
EventException::EventException(
    const std::string* const error_msg_ref,
    const std::string* const debug_info_ref,
    const std::string* const event_line_ref
)
{
    if (error_msg_ref != nullptr)
    {
        error_msg = std::unique_ptr<std::string>(new std::string(*error_msg_ref));
    }
    if (debug_info_ref != nullptr)
    {
        debug_info = std::unique_ptr<std::string>(new std::string(*debug_info_ref));
    }
    if (event_line_ref != nullptr)
    {
        event_line = std::unique_ptr<std::string>(new std::string(*event_line_ref));
    }
}

EventException::~EventException() noexcept
{
}

// @throws std::bad_alloc
void EventException::set_debug_info(const std::string* const debug_info_ref)
{
    if (debug_info_ref != nullptr)
    {
        debug_info = std::unique_ptr<std::string>(new std::string(*debug_info_ref));
    }
    else
    {
        debug_info = nullptr;
    }
}

// @throws std::bad_alloc
void EventException::set_event_line(const std::string* const event_line_ref)
{
    if (event_line_ref != nullptr)
    {
        event_line = std::unique_ptr<std::string>(new std::string(*event_line_ref));
    }
    else
    {
        event_line = nullptr;
    }
}

const std::string* EventException::get_error_msg() const noexcept
{
    return error_msg.get();
}

const std::string* EventException::get_debug_info() const noexcept
{
    return debug_info.get();
}

const std::string* EventException::get_event_line() const noexcept
{
    return event_line.get();
}

// @throws std::bad_alloc
EventMessageException::EventMessageException(
    const std::string* const error_msg_ref,
    const std::string* const debug_info_ref,
    const std::string* const event_line_ref
):
    EventException::EventException(error_msg_ref, debug_info_ref, event_line_ref)
{
}

EventMessageException::~EventMessageException() noexcept
{
}

// @throws std::bad_alloc
EventObjectException::EventObjectException(
    const std::string* const error_msg_ref,
    const std::string* const debug_info_ref,
    const std::string* const event_line_ref
):
    EventException::EventException(error_msg_ref, debug_info_ref, event_line_ref)
{
}

EventObjectException::~EventObjectException() noexcept
{
}

// @throws std::bad_alloc
EventsSourceException::EventsSourceException(
    const std::string* const error_msg_ref,
    const std::string* const debug_info_ref,
    const std::string* const event_line_ref
):
    EventException::EventException(error_msg_ref, debug_info_ref, event_line_ref)
{
}

EventsSourceException::~EventsSourceException() noexcept
{
}

// @throws std::bad_alloc
EventsIoException::EventsIoException(
    const std::string* const error_msg_ref,
    const std::string* const debug_info_ref,
    const std::string* const event_line_ref
):
    EventException::EventException(error_msg_ref, debug_info_ref, event_line_ref)
{
}

EventsIoException::~EventsIoException() noexcept
{
}