* limitations under the License.
*/
-#ifndef FOLLY_EXCEPTION_H_
-#define FOLLY_EXCEPTION_H_
+#pragma once
#include <errno.h>
// The *Explicit functions take an explicit value for errno.
// Helper to throw std::system_error
-FOLLY_NORETURN void throwSystemErrorExplicit(int err, const char*);
-inline void throwSystemErrorExplicit(int err, const char* msg) {
+[[noreturn]] inline void throwSystemErrorExplicit(int err, const char* msg) {
throw std::system_error(err, std::system_category(), msg);
}
template <class... Args>
-FOLLY_NORETURN void throwSystemErrorExplicit(int, Args&&... args);
-template <class... Args>
-void throwSystemErrorExplicit(int err, Args&&... args) {
+[[noreturn]] void throwSystemErrorExplicit(int err, Args&&... args) {
throwSystemErrorExplicit(
err, to<fbstring>(std::forward<Args>(args)...).c_str());
}
// Helper to throw std::system_error from errno and components of a string
template <class... Args>
-FOLLY_NORETURN void throwSystemError(Args&&... args);
-template <class... Args>
-void throwSystemError(Args&&... args) {
+[[noreturn]] void throwSystemError(Args&&... args) {
throwSystemErrorExplicit(errno, std::forward<Args>(args)...);
}
::folly::throwOnFail<E>((cond), "Check failed: " #cond)
} // namespace folly
-
-#endif /* FOLLY_EXCEPTION_H_ */