lib45d
45Drives C++ Library API Documentation
Exceptions.hpp
1 // -*- C++ -*-
2 /*
3  * Copyright (C) 2021 Joshua Boudreau <jboudreau@45drives.com>
4  *
5  * This file is part of lib45d.
6  *
7  * lib45d is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * lib45d is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with lib45d. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 #pragma once
22 
23 #include <45d/Exceptions.hpp>
24 
25 namespace ffd {
30  class SocketException : public Exception {
31  public:
32  SocketException(const std::string &what, int err = 0) : Exception(what, err) {}
33  };
34 
40  public:
41  SocketCreateException(const std::string &what, int err = 0) : SocketException(what, err) {}
42  };
43 
49  public:
50  SocketCloseException(const std::string &what, int err = 0) : SocketException(what, err) {}
51  };
52 
58  public:
59  SocketAddressException(const std::string &what, int err = 0) : SocketException(what, err) {}
60  };
61 
67  public:
68  SocketBindException(const std::string &what, int err = 0) : SocketException(what, err) {}
69  };
70 
72  public:
73  SocketListenException(const std::string &what, int err = 0) : SocketException(what, err) {}
74  };
75 
81  public:
82  SocketAcceptException(const std::string &what, int err = 0) : SocketException(what, err) {}
83  };
84 
90  public:
91  SocketConnectException(const std::string &what, int err = 0) : SocketException(what, err) {}
92  };
93 
99  public:
100  SocketWriteException(const std::string &what, int err = 0) : SocketException(what, err) {}
101  };
102 
108  public:
109  SocketReadException(const std::string &what, int err = 0) : SocketException(what, err) {}
110  };
111 
117  public:
118  SocketShutdownException(const std::string &what, int err = 0)
119  : SocketException(what, err) {}
120  };
121 } // namespace ffd
ffd::SocketException
General exception for all Socket* related issues.
Definition: Exceptions.hpp:30
ffd::SocketShutdownException
Thrown when shutdown() fails.
Definition: Exceptions.hpp:116
ffd::SocketBindException
Thrown when bind() fails.
Definition: Exceptions.hpp:66
ffd::SocketReadException
Thrown when read() fails.
Definition: Exceptions.hpp:107
ffd::SocketCloseException
Thrown when close(fd_) returns -1 with strerror(errno) as what.
Definition: Exceptions.hpp:48
ffd::SocketListenException
Definition: Exceptions.hpp:71
ffd::SocketAddressException
Thrown when the socket address is too long.
Definition: Exceptions.hpp:57
ffd
45Drives namespace
Definition: Bytes.hpp:27
ffd::SocketWriteException
Thrown when write() fails.
Definition: Exceptions.hpp:98
ffd::Exception::what
const char * what(void) const noexcept
Return string containing explanation message.
Definition: Exceptions.hpp:44
ffd::SocketCreateException
Thrown when socket() returns -1 with strerror(errno) as what.
Definition: Exceptions.hpp:39
ffd::Exception::Exception
Exception(const std::string &what, int err=0) noexcept
Construct a new Exception object.
Definition: Exceptions.hpp:38
ffd::SocketConnectException
Thrown when connect() fails.
Definition: Exceptions.hpp:89
ffd::Exception
Exceptions thrown by this library.
Definition: Exceptions.hpp:30
ffd::SocketAcceptException
Thrown when accept() fails.
Definition: Exceptions.hpp:80