29#include "//include/dar/libdar_my_config.h"
33#include "//include/dar/integers.hpp"
55 Egeneric(
const std::string &source,
const std::string &message);
73 void stack(
const std::string & passage,
const std::string & message =
"") { pile.push_back(niveau(passage, message)); };
74 void stack(
const std::string && passage,
const std::string && message =
"") {
pile.push_back(niveau(std::move(passage), std::move(message))); };
82 const std::string &
get_message()
const {
return pile.front().objet; };
85 const std::string &
get_source()
const {
return pile.front().lieu; };
91 const std::string &
find_object(
const std::string & location)
const;
100 virtual std::string exceptionID()
const = 0;
105 niveau(
const std::string & ou,
const std::string & quoi) { lieu = ou; objet = quoi; };
106 niveau(std::string && ou, std::string && quoi) { lieu = std::move(ou); objet = std::move(quoi); };
107 niveau(
const niveau & ref) =
default;
108 niveau(niveau && ref)
noexcept =
default;
109 niveau & operator = (
const niveau & ref) =
default;
110 niveau & operator = (niveau && ref)
noexcept =
default;
113 std::string lieu, objet;
116 std::deque<niveau> pile;
118 static const std::string empty_string;
130 Ememory(
const Ememory & ref) =
default;
131 Ememory(Ememory && ref) =
default;
132 Ememory & operator = (
const Ememory & ref) =
default;
133 Ememory & operator = (Ememory && ref) =
default;
134 ~Ememory() =
default;
137 Ememory(
const std::string &source,
const std::string & message) :
Egeneric(source, message) {};
138 virtual std::string exceptionID()
const override {
return "MEMORY"; };
143 class Esecu_memory :
public Ememory
146 Esecu_memory(
const std::string &source) : Ememory(source,
dar_gettext(
"Lack of Secured Memory")) {};
147 Esecu_memory(
const Esecu_memory & ref) =
default;
148 Esecu_memory(Esecu_memory && ref) =
default;
149 Esecu_memory & operator = (
const Esecu_memory & ref) =
default;
150 Esecu_memory & operator = (Esecu_memory && ref) =
default;
151 ~Esecu_memory() =
default;
154 virtual std::string exceptionID()
const override {
return "SECU_MEMORY"; };
158#define SRC_BUG Ebug(__FILE__, __LINE__)
165 Ebug(
const std::string & file, S_I line);
166 Ebug(
const Ebug & ref) =
default;
167 Ebug(Ebug && ref) =
default;
168 Ebug & operator = (
const Ebug & ref) =
default;
169 Ebug & operator = (Ebug && ref) =
default;
173 void stack(
const std::string & passage,
const std::string & file,
const std::string & line);
176 virtual std::string exceptionID()
const override {
return "BUG"; };
186 Einfinint(
const std::string & source,
const std::string & message) :
Egeneric(source, message) {};
187 Einfinint(
const Einfinint & ref) =
default;
188 Einfinint(Einfinint && ref) =
default;
189 Einfinint & operator = (
const Einfinint & ref) =
default;
190 Einfinint & operator = (Einfinint && ref) =
default;
191 ~Einfinint() =
default;
194 virtual std::string exceptionID()
const override {
return "INFININT"; };
204 Elimitint() :
Egeneric(
"",
dar_gettext(
"Cannot handle such a large integer. Use a full version of libdar (compiled to rely on the \"infinint\" integer type) to solve this problem")) {};
205 Elimitint(
const Elimitint & ref) =
default;
206 Elimitint(Elimitint && ref) =
default;
207 Elimitint & operator = (
const Elimitint & ref) =
default;
208 Elimitint & operator = (Elimitint && ref) =
default;
209 ~Elimitint() =
default;
212 virtual std::string exceptionID()
const override {
return "LIMITINT"; };
222 Erange(
const std::string & source,
const std::string & message) :
Egeneric(source, message) {};
223 Erange(
const Erange & ref) =
default;
224 Erange(Erange && ref) =
default;
225 Erange & operator = (
const Erange & ref) =
default;
226 Erange & operator = (Erange && ref) =
default;
230 virtual std::string exceptionID()
const override {
return "RANGE"; };
241 Edeci(
const std::string & source,
const std::string & message) :
Egeneric(source, message) {};
242 Edeci(
const Edeci & ref) =
default;
243 Edeci(Edeci && ref) =
default;
244 Edeci & operator = (
const Edeci & ref) =
default;
245 Edeci & operator = (Edeci && ref) =
default;
249 virtual std::string exceptionID()
const override {
return "DECI"; };
259 Efeature(
const std::string & message) :
Egeneric(
"", message) {};
260 Efeature(
const Efeature & ref) =
default;
261 Efeature(Efeature && ref) =
default;
262 Efeature & operator = (
const Efeature & ref) =
default;
263 Efeature & operator = (Efeature && ref) =
default;
264 ~Efeature() =
default;
267 virtual std::string exceptionID()
const override {
return "UNIMPLEMENTED FEATURE"; };
277 Ehardware(
const std::string & source,
const std::string & message) :
Egeneric(source, message) {};
278 Ehardware(
const Ehardware & ref) =
default;
279 Ehardware(Ehardware && ref) =
default;
280 Ehardware & operator = (
const Ehardware & ref) =
default;
281 Ehardware & operator = (Ehardware && ref) =
default;
282 ~Ehardware() =
default;
285 virtual std::string exceptionID()
const override {
return "HARDWARE ERROR"; };
295 Euser_abort(
const std::string & msg) :
Egeneric(
"",msg) {};
296 Euser_abort(
const Euser_abort & ref) =
default;
297 Euser_abort(Euser_abort && ref) =
default;
298 Euser_abort & operator = (
const Euser_abort & ref) =
default;
299 Euser_abort & operator = (Euser_abort && ref) =
default;
300 ~Euser_abort() =
default;
303 virtual std::string exceptionID()
const override {
return "USER ABORTED OPERATION"; };
314 Edata(
const std::string & msg) :
Egeneric(
"", msg) {};
315 Edata(
const Edata & ref) =
default;
316 Edata(Edata && ref) =
default;
317 Edata & operator = (
const Edata & ref) =
default;
318 Edata & operator = (Edata && ref) =
default;
322 virtual std::string exceptionID()
const override {
return "ERROR IN TREATED DATA"; };
332 Escript(
const std::string & source,
const std::string & msg) :
Egeneric(source ,msg) {};
333 Escript(
const Escript & ref) =
default;
334 Escript(Escript && ref) =
default;
335 Escript & operator = (
const Escript & ref) =
default;
336 Escript & operator = (Escript && ref) =
default;
337 ~Escript() =
default;
340 virtual std::string exceptionID()
const override {
return "USER ABORTED OPERATION"; };
350 Elibcall(
const std::string & source,
const std::string & msg) :
Egeneric(source ,msg) {};
351 Elibcall(
const Elibcall & ref) =
default;
352 Elibcall(Elibcall && ref) =
default;
353 Elibcall & operator = (
const Elibcall & ref) =
default;
354 Elibcall & operator = (Elibcall && ref) =
default;
355 ~Elibcall() =
default;
358 virtual std::string exceptionID()
const override {
return "USER ABORTED OPERATION"; };
368 Ecompilation(
const std::string & msg) :
Egeneric(
"" ,msg) {};
369 Ecompilation(
const Ecompilation & ref) =
default;
370 Ecompilation(Ecompilation && ref) =
default;
371 Ecompilation & operator = (
const Ecompilation & ref) =
default;
372 Ecompilation & operator = (Ecompilation && ref) =
default;
373 ~Ecompilation() =
default;
376 virtual std::string exceptionID()
const override {
return "FEATURE DISABLED AT COMPILATION TIME"; };
385 Ethread_cancel(
bool now, U_64 x_flag) :
Egeneric(
"", now ?
dar_gettext(
"Thread cancellation requested, aborting as soon as possible") :
dar_gettext(
"Thread cancellation requested, aborting as properly as possible")) { immediate = now; flag = x_flag; };
386 Ethread_cancel(
const Ethread_cancel & ref) =
default;
387 Ethread_cancel(Ethread_cancel && ref) =
default;
388 Ethread_cancel & operator = (
const Ethread_cancel & ref) =
default;
389 Ethread_cancel & operator = (Ethread_cancel && ref) =
default;
390 ~Ethread_cancel() =
default;
392 bool immediate_cancel()
const {
return immediate; };
393 U_64 get_flag()
const {
return flag; };
396 virtual std::string exceptionID()
const override {
return "THREAD CANCELLATION REQUESTED, ABORTING"; };
416 Esystem(
const std::string & source,
const std::string & message,
io_error code);
423 io_error get_code()
const {
return x_code; };
426 virtual std::string exceptionID()
const override {
return "SYSTEM ERROR MET"; };
437 Enet_auth(
const std::string & message):
Egeneric(
"on the network", message) {};
438 Enet_auth(
const Enet_auth & ref) =
default;
439 Enet_auth(Enet_auth && ref) =
default;
440 Enet_auth & operator = (
const Enet_auth & ref) =
default;
441 Enet_auth & operator = (Enet_auth && ref) =
default;
442 ~Enet_auth() =
default;
445 virtual std::string exceptionID()
const override {
return "NETWORK AUTHENTICATION ERROR"; };
void stack(const std::string &passage, const std::string &message="")
add more detailed couple of information to the exception
Egeneric(const std::string &source, const std::string &message)
the constructor
Egeneric(Egeneric &&ref)=default
move constructor
virtual ~Egeneric()=default
the destructor
const std::string & get_source() const
get the call function which has thrown this exception
void prepend_message(const std::string &context)
prepend error message by the given string
std::string dump_str() const
return a string result of the exception information dump
Egeneric(const Egeneric &ref)=default
copy constructor
const std::string & get_message() const
get the message explaing the nature of the exception
const std::string & find_object(const std::string &location) const
retrieve the objet (object) associated to a given "lieu" (location) from the stack
Egeneric & operator=(const Egeneric &ref)=default
assignment operator
exception used to carry system error
@ io_access
permission denied (any mode)
@ io_ro_fs
read-only filesystem (write mode/read-write mode)
@ io_absent
file does not exist (read mode)
@ io_exist
file already exists (write mode)
stores a stack of generic_files writing/reading on each others
const char * dar_gettext(const char *)
a routine to change NLS domaine forth and back for inline routines
libdar namespace encapsulate all libdar symbols