-// Helper to throw std::system_error
-FOLLY_NORETURN void throwSystemErrorExplicit(int err, const char*);
-inline void throwSystemErrorExplicit(int err, const char* msg) {
- throw std::system_error(err, std::system_category(), msg);
+inline std::system_error makeSystemErrorExplicit(int err, const char* msg) {
+ // TODO: The C++ standard indicates that std::generic_category() should be
+ // used for POSIX errno codes.
+ //
+ // We should ideally change this to use std::generic_category() instead of
+ // std::system_category(). However, undertaking this change will require
+ // updating existing call sites that currently catch exceptions thrown by
+ // this code and currently expect std::system_category.
+ return std::system_error(err, std::system_category(), msg);