31 #ifndef PNGPP_ERROR_HPP_INCLUDED 32 #define PNGPP_ERROR_HPP_INCLUDED 35 #ifdef __STDC_LIB_EXT1__ 36 #define __STDC_WANT_LIB_EXT1__ 1 39 #define HAVE_STRERROR_S 1 41 #undef HAVE_STRERROR_S 58 :
public std::runtime_error
64 explicit error(std::string
const& message)
65 : std::runtime_error(message)
77 :
public std::runtime_error
88 explicit std_error(std::string
const& message,
int errnum = errno)
89 : std::runtime_error((message +
": ") + thread_safe_strerror(errnum))
96 #define ERRBUF_SIZE 512 97 char buf[ERRBUF_SIZE] = { 0 };
99 #ifdef HAVE_STRERROR_S 100 strerror_s(buf, ERRBUF_SIZE, errnum);
101 return std::string(buf);
103 #if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE 104 strerror_r(errnum, buf, ERRBUF_SIZE);
105 return std::string(buf);
108 return std::string(strerror_r(errnum, buf, ERRBUF_SIZE));
118 #endif // PNGPP_ERROR_HPP_INCLUDED std_error(std::string const &message, int errnum=errno)
Definition: error.hpp:88
static std::string thread_safe_strerror(int errnum)
Definition: error.hpp:94
Exception class to represent standard library errors (generally IO).
Definition: error.hpp:76
error(std::string const &message)
Definition: error.hpp:64
Exception class to represent runtime errors related to png++ operation.
Definition: error.hpp:57