Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/common/exception.h" 4 : 5 : namespace Envoy { 6 : namespace Network { 7 : 8 : /** 9 : * Thrown when a socket option cannot be applied. 10 : */ 11 : class SocketOptionException : public EnvoyException { 12 : public: 13 0 : SocketOptionException(const std::string& what) : EnvoyException(what) {} 14 : }; 15 : 16 : /** 17 : * Thrown when there is a runtime error binding a socket. 18 : */ 19 : class SocketBindException : public EnvoyException { 20 : public: 21 : SocketBindException(const std::string& what, int error_number) 22 0 : : EnvoyException(what), error_number_(error_number) {} 23 : 24 : // This can't be called errno because otherwise the standard errno macro expansion replaces it. 25 0 : int errorNumber() const { return error_number_; } 26 : 27 : private: 28 : const int error_number_; 29 : }; 30 : 31 : } // namespace Network 32 : } // namespace Envoy