From 113b1f4bbdecfab24ed9781b730a76a442adad6f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 19 Sep 2008 11:15:14 +0200 Subject: Exceptions vereinheitlicht --- src/Net/IPAddress.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Net/IPAddress.cpp') 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); } -- cgit v1.2.3