src/Network/Error.cc
author Tero Marttila <terom@fixme.fi>
Thu, 22 Jan 2009 02:56:50 +0200
branchnew_graphics
changeset 420 278020dcd9b7
parent 381 9b35bc329d23
child 423 947ab54de4b7
permissions -rw-r--r--
clean up Server/Client log output a bit
380
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     1
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     2
#include "Error.hh"
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     3
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     4
#include <cerrno>
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     5
#include <sstream>
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     6
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     7
std::string NetworkErrno::build_str (std::string op, int err) {
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     8
    std::stringstream ss;
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
     9
381
9b35bc329d23 separate sockaddr stuff out of NetworkAddress... now called NetworkEndpoint
terom
parents: 380
diff changeset
    10
    ss << op << ": " << strerror(err);
380
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    11
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    12
    return ss.str();
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    13
}
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    14
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    15
NetworkErrno::NetworkErrno (std::string op) :
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    16
    Error(build_str(op, errno)), err(errno)
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    17
{ 
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    18
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    19
}
d193dd1d8a7e new NetworkReactor, fix everything to actually work
terom
parents:
diff changeset
    20