+#include <msp/core/except.h>
#include <msp/core/refptr.h>
#include <msp/net/resolve.h>
#include <msp/time/timedelta.h>
void Client::start_request(const Request &r)
{
if(request)
- throw client_busy();
+ throw invalid_state("already processing a request");
delete sock;
sock = 0;
namespace Msp {
namespace Http {
-class client_busy: public std::logic_error
-{
-public:
- client_busy(): std::logic_error(std::string()) { }
-};
-
class Request;
class Response;
#ifndef MSP_NET_COMMUNICATOR_H_
#define MSP_NET_COMMUNICATOR_H_
+#include <msp/core/except.h>
#include <sigc++/signal.h>
#include "protocol.h"
class StreamSocket;
-class sequence_error: public std::logic_error
+class sequence_error: public invalid_state
{
public:
- sequence_error(const std::string &w): std::logic_error(w) { }
+ sequence_error(const std::string &w): invalid_state(w) { }
};
class incompatible_protocol: public std::runtime_error
+#include <msp/core/except.h>
#include "serversocket.h"
using namespace std;
size_t ServerSocket::do_write(const char *, size_t)
{
- throw logic_error("can't write to ServerSocket");
+ throw unsupported("ServerSocket::write");
}
size_t ServerSocket::do_read(char *, size_t)
{
- throw logic_error("can't read from ServerSocket");
+ throw unsupported("ServerSocket::read");
}
} // namespace Net
const IO::Handle &Socket::get_handle(IO::Mode)
{
// TODO could this be implemented somehow?
- throw logic_error("Socket::get_handle");
+ throw unsupported("Socket::get_handle");
}
const IO::Handle &Socket::get_event_handle()
#ifndef MSP_NET_SOCKET_H_
#define MSP_NET_SOCKET_H_
+#include <msp/core/except.h>
#include <msp/io/eventobject.h>
#include <msp/io/handle.h>
#include "constants.h"
namespace Msp {
namespace Net {
-class bad_socket_state: public std::logic_error
+class bad_socket_state: public invalid_state
{
public:
- bad_socket_state(const std::string &w): std::logic_error(w) { }
+ bad_socket_state(const std::string &w): invalid_state(w) { }
};
abstract(a)
{
if(sizeof(sa_family_t)+path.size()+1>sizeof(sockaddr_storage))
- throw invalid_argument("UnixAddr");
+ throw invalid_argument("UnixAddr::UnixAddr");
}
SockAddr::SysAddr UnixAddr::to_sys() const
-#include <stdexcept>
+#include <msp/core/except.h>
#include "platform_api.h"
#include "sockaddr_private.h"
#include "unix.h"
UnixAddr::UnixAddr(const SysAddr &):
abstract(false)
{
- throw logic_error("AF_UNIX not supported");
+ throw unsupported("AF_UNIX");
}
UnixAddr::UnixAddr(const string &p, bool a):
SockAddr::SysAddr UnixAddr::to_sys() const
{
- throw logic_error("AF_UNIX not supported");
+ throw unsupported("AF_UNIX");
}
} // namespace Net