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>
58 class ecl_exceptions_PUBLIC PosixErrorHandler {
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_ */
ecl_exceptions_PUBLIC
#define ecl_exceptions_PUBLIC
Definition: macros.hpp:37
ecl::PosixError
PosixError
standard_exception.hpp
Standard exception type, provides code location and error string.
ecl


ecl_exceptions
Author(s): Daniel Stonier
autogenerated on Sun Aug 2 2020 03:12:04