Baton support for wait-options
[folly.git] / folly / IPAddressException.h
index 86f8a5ac8dc59dfa8887a82c1aea1c9ba7f03c66..0ba74621a8f766628a5a625b3ac607edd9ebcac0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2017-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 #pragma once
 
 #include <exception>
 #include <string>
 #include <utility>
 
+#include <folly/CPortability.h>
 #include <folly/detail/IPAddress.h>
 
 namespace folly {
 
+/**
+ * Error codes for non-throwing interface of IPAddress family of functions.
+ */
+enum class IPAddressFormatError { INVALID_IP, UNSUPPORTED_ADDR_FAMILY };
+
 /**
  * Exception for invalid IP addresses.
  */
-class IPAddressFormatException : public std::exception {
+class FOLLY_EXPORT IPAddressFormatException : public std::exception {
  public:
   explicit IPAddressFormatException(std::string msg) noexcept
       : msg_(std::move(msg)) {}
@@ -38,7 +43,7 @@ class IPAddressFormatException : public std::exception {
   IPAddressFormatException& operator=(IPAddressFormatException&&) = default;
 
   ~IPAddressFormatException() noexcept override {}
-  const char* what(void) const noexcept override {
+  const char* what() const noexcept override {
     return msg_.c_str();
   }
 
@@ -46,7 +51,8 @@ class IPAddressFormatException : public std::exception {
   std::string msg_;
 };
 
-class InvalidAddressFamilyException : public IPAddressFormatException {
+class FOLLY_EXPORT InvalidAddressFamilyException
+    : public IPAddressFormatException {
  public:
   explicit InvalidAddressFamilyException(std::string msg) noexcept
       : IPAddressFormatException(std::move(msg)) {}
@@ -62,4 +68,4 @@ class InvalidAddressFamilyException : public IPAddressFormatException {
       default;
 };
 
-}  // folly
+} // namespace folly