w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rexception.cpp
Go to the documentation of this file.
1// $Id: Rexception.cpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2018-10-27 1060 1.3 drop throw() list; use noexcept
8// 2017-04-29 888 1.2 BUGFIX: add fErrtxt for proper what() return
9// 2014-12-30 625 1.1 add ctor(meth,text,emsg)
10// 2013-01-12 474 1.0 Initial version
11// ---------------------------------------------------------------------------
12
17#include "Rexception.hpp"
18
19using namespace std;
20
26// all method definitions in namespace Retro
27namespace Retro {
28
29//------------------------------------------+-----------------------------------
31
33 : fErrmsg(),
34 fErrtxt()
35{
36}
37
38//------------------------------------------+-----------------------------------
40
42 : fErrmsg(errmsg),
43 fErrtxt(fErrmsg.Message())
44{}
45
46//------------------------------------------+-----------------------------------
48
49Rexception::Rexception(const std::string& meth, const std::string& text)
50 : fErrmsg(meth,text),
51 fErrtxt(fErrmsg.Message())
52{}
53
54//------------------------------------------+-----------------------------------
56
57Rexception::Rexception(const std::string& meth, const std::string& text,
58 int errnum)
59 : fErrmsg(meth,text,errnum),
60 fErrtxt(fErrmsg.Message())
61{}
62
63//------------------------------------------+-----------------------------------
65
66Rexception::Rexception(const std::string& meth, const std::string& text,
67 const RerrMsg& errmsg)
68 : fErrmsg(meth,text+errmsg.Message()),
69 fErrtxt(fErrmsg.Message())
70{}
71
72//------------------------------------------+-----------------------------------
74
76{}
77
78//------------------------------------------+-----------------------------------
80
81const char* Rexception::what() const noexcept
82{
83 // what() must return a pointer to a string which stays valid at least as long
84 // as the exception object lives. Use member variable fErrtxt for this.
85 return fErrtxt.c_str();
86}
87
88} // end namespace Retro
FIXME_docs.
Definition: RerrMsg.hpp:25
Rexception()
Default constructor.
Definition: Rexception.cpp:32
virtual const char * what() const noexcept
FIXME_docs.
Definition: Rexception.cpp:81
~Rexception()
Destructor.
Definition: Rexception.cpp:75
std::string fErrtxt
message text (for what())
Definition: Rexception.hpp:46
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47