networkexceptions.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. Minetest
  3. Copyright (C) 2013-2017 celeron55, Perttu Ahola <celeron55@gmail.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #pragma once
  17. #include "exceptions.h"
  18. namespace con
  19. {
  20. /*
  21. Exceptions
  22. */
  23. class NotFoundException : public BaseException
  24. {
  25. public:
  26. NotFoundException(const char *s) : BaseException(s) {}
  27. };
  28. class PeerNotFoundException : public BaseException
  29. {
  30. public:
  31. PeerNotFoundException(const char *s) : BaseException(s) {}
  32. };
  33. class ConnectionException : public BaseException
  34. {
  35. public:
  36. ConnectionException(const char *s) : BaseException(s) {}
  37. };
  38. class ConnectionBindFailed : public BaseException
  39. {
  40. public:
  41. ConnectionBindFailed(const char *s) : BaseException(s) {}
  42. };
  43. class InvalidIncomingDataException : public BaseException
  44. {
  45. public:
  46. InvalidIncomingDataException(const char *s) : BaseException(s) {}
  47. };
  48. class InvalidOutgoingDataException : public BaseException
  49. {
  50. public:
  51. InvalidOutgoingDataException(const char *s) : BaseException(s) {}
  52. };
  53. class NoIncomingDataException : public BaseException
  54. {
  55. public:
  56. NoIncomingDataException(const char *s) : BaseException(s) {}
  57. };
  58. class ProcessedSilentlyException : public BaseException
  59. {
  60. public:
  61. ProcessedSilentlyException(const char *s) : BaseException(s) {}
  62. };
  63. class ProcessedQueued : public BaseException
  64. {
  65. public:
  66. ProcessedQueued(const char *s) : BaseException(s) {}
  67. };
  68. class IncomingDataCorruption : public BaseException
  69. {
  70. public:
  71. IncomingDataCorruption(const char *s) : BaseException(s) {}
  72. };
  73. }
  74. class SocketException : public BaseException
  75. {
  76. public:
  77. SocketException(const std::string &s) : BaseException(s) {}
  78. };
  79. class ResolveError : public BaseException
  80. {
  81. public:
  82. ResolveError(const std::string &s) : BaseException(s) {}
  83. };
  84. class SendFailedException : public BaseException
  85. {
  86. public:
  87. SendFailedException(const std::string &s) : BaseException(s) {}
  88. };