proxygen
IPAddressException.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <exception>
19 #include <string>
20 #include <utility>
21 
22 #include <folly/CPortability.h>
23 #include <folly/detail/IPAddress.h>
24 
25 namespace folly {
26 
31 
35 enum class CIDRNetworkError {
38  INVALID_IP,
41 };
42 
46 class FOLLY_EXPORT IPAddressFormatException : public std::exception {
47  public:
49  : msg_(std::move(msg)) {}
53  default;
54  IPAddressFormatException& operator=(IPAddressFormatException&&) = default;
55 
57  const char* what() const noexcept override {
58  return msg_.c_str();
59  }
60 
61  private:
63 };
64 
66  : public IPAddressFormatException {
67  public:
70  explicit InvalidAddressFamilyException(sa_family_t family) noexcept
72  "Address family " + detail::familyNameStr(family) +
73  " is not AF_INET or AF_INET6") {}
77  const InvalidAddressFamilyException&) = default;
79  default;
80 };
81 
82 } // namespace folly
InvalidAddressFamilyException(sa_family_t family) noexcept
~IPAddressFormatException() noexceptoverride
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
#define FOLLY_EXPORT
Definition: CPortability.h:133
requires E e noexcept(noexcept(s.error(std::move(e))))
IPAddressFormatException(std::string msg) noexcept
const char * what() const noexceptoverride
const char * string
Definition: Conv.cpp:212
InvalidAddressFamilyException(std::string msg) noexcept
const
Definition: upload.py:398
std::string familyNameStr(sa_family_t family)
Definition: IPAddress.h:30