posix_error_handler.hpp
Go to the documentation of this file.
1 
13 /*****************************************************************************
14 ** Ifdefs
15 *****************************************************************************/
16 
17 #ifndef ECL_EXCEPTIONS_POSIX_EXCEPTION_HPP_
18 #define ECL_EXCEPTIONS_POSIX_EXCEPTION_HPP_
19 
20 /*****************************************************************************
21 ** Disable check
22 *****************************************************************************/
23 
24 #include <ecl/config/ecl.hpp>
25 #ifndef ECL_DISABLE_EXCEPTIONS
26 
27 /*****************************************************************************
28 ** Includes
29 *****************************************************************************/
30 
31 #include <cstring> // strerror function
32 #include <string>
33 #include <errno.h>
34 #include "standard_exception.hpp"
35 
36 /*****************************************************************************
37 ** Namespaces
38 *****************************************************************************/
39 
40 namespace ecl {
41 
42 /*****************************************************************************
43 ** Interface [PosixErrorHandler]
44 *****************************************************************************/
57 template <typename ThrowingClass>
59 public:
69  static StandardException GenerateStandardException(const char* loc) {
70  return StandardException(loc, PosixError, std::string(strerror(errno))+".");
71  }
72  virtual ~PosixErrorHandler() {}
73 };
74 
75 }; // namespace ecl
76 
77 #endif /* ECL_DISABLE_EXCEPTIONS */
78 #endif /* ECL_EXCEPTIONS_POSIX_EXCEPTION_HPP_ */
#define ecl_exceptions_PUBLIC
Definition: macros.hpp:37
Provides c++ mechanisms for handling posix errors.
Standard exception type, provides code location and error string.
static StandardException GenerateStandardException(const char *loc)
Standard exception type, provides code location and error string.
PosixError


ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:26