+ /**
+ * All the constructors that are not noexcept can throw std::system_error.
+ * This is a helper method to use folly::Expected to chain a file open event
+ * to something else you want to do with the open fd.
+ */
+ template <typename... Args>
+ static Expected<File, exception_wrapper> makeFile(Args&&... args) noexcept {
+ try {
+ return File(std::forward<Args>(args)...);
+ } catch (const std::system_error& se) {
+ return makeUnexpected(exception_wrapper(std::current_exception(), se));
+ }
+ }
+