diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-19 11:15:14 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-19 11:15:14 +0200 |
commit | 113b1f4bbdecfab24ed9781b730a76a442adad6f (patch) | |
tree | e28f5c9a7a1afebd7d920f1006aacff401894dbc /src/Net/IPAddress.cpp | |
parent | 793a0789858734141dfa12d2ab3dd6ea3ed293e8 (diff) | |
download | mad-113b1f4bbdecfab24ed9781b730a76a442adad6f.tar mad-113b1f4bbdecfab24ed9781b730a76a442adad6f.zip |
Exceptions vereinheitlicht
Diffstat (limited to 'src/Net/IPAddress.cpp')
-rw-r--r-- | src/Net/IPAddress.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Net/IPAddress.cpp b/src/Net/IPAddress.cpp index 9c9793e..6bf79a3 100644 --- a/src/Net/IPAddress.cpp +++ b/src/Net/IPAddress.cpp @@ -36,7 +36,7 @@ IPAddress::IPAddress(uint32_t address, uint16_t port0) : addr(address), port(por sa.sin_addr.s_addr = htonl(addr); } -IPAddress::IPAddress(const std::string &address) throw(InvalidAddressException) { +IPAddress::IPAddress(const std::string &address) throw(Common::Exception) { std::string ip; size_t pos = address.find_first_of(':'); @@ -51,7 +51,7 @@ IPAddress::IPAddress(const std::string &address) throw(InvalidAddressException) char *endptr; port = std::strtol(address.substr(pos+1).c_str(), &endptr, 10); if(*endptr != 0 || port == 0) - throw InvalidAddressException(address); + throw Common::Exception(Common::Exception::INVALID_ADDRESS); } sa.sin_family = AF_INET; @@ -60,17 +60,17 @@ IPAddress::IPAddress(const std::string &address) throw(InvalidAddressException) if(ip == "*") sa.sin_addr.s_addr = INADDR_ANY; else if(!inet_pton(AF_INET, ip.c_str(), &sa.sin_addr)) - throw InvalidAddressException(address); + throw Common::Exception(Common::Exception::INVALID_ADDRESS); addr = ntohl(sa.sin_addr.s_addr); } -IPAddress::IPAddress(const std::string &address, uint16_t port0) throw(InvalidAddressException) : port(port0) { +IPAddress::IPAddress(const std::string &address, uint16_t port0) throw(Common::Exception) : port(port0) { sa.sin_family = AF_INET; sa.sin_port = htons(port); if(!inet_pton(AF_INET, address.c_str(), &sa.sin_addr)) - throw InvalidAddressException(address); + throw Common::Exception(Common::Exception::INVALID_ADDRESS); addr = ntohl(sa.sin_addr.s_addr); } |