diff --git a/CMakeLists.txt b/CMakeLists.txt index 19977cc89..c951518b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,7 +159,6 @@ endif(DOXYGEN_FOUND) if(CPP-NETLIB_BUILD_SINGLE_LIB) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/config/src - ${CMAKE_CURRENT_SOURCE_DIR}/error/src ${CMAKE_CURRENT_SOURCE_DIR}/concurrency/src ${CMAKE_CURRENT_SOURCE_DIR}/http/src ${CMAKE_CURRENT_SOURCE_DIR}/logging/src @@ -172,7 +171,6 @@ endif() add_subdirectory(uri) add_subdirectory(message) add_subdirectory(logging) -add_subdirectory(error) add_subdirectory(http) add_subdirectory(concurrency) #add_subdirectory(mime) diff --git a/error/CMakeLists.txt b/error/CMakeLists.txt deleted file mode 100644 index 560d600d9..000000000 --- a/error/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) Glyn Matthews 2013. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -add_subdirectory(src) - -if(CPP-NETLIB_BUILD_TESTS) - enable_testing() - add_subdirectory(test) -endif(CPP-NETLIB_BUILD_TESTS) - -# propagate sources to parent directory for one-lib-build -set(CPP-NETLIB_ERROR_SRCS ${CPP-NETLIB_ERROR_SRCS} PARENT_SCOPE) diff --git a/error/src/CMakeLists.txt b/error/src/CMakeLists.txt deleted file mode 100644 index 8fe76d568..000000000 --- a/error/src/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) Glyn Matthews 2013. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -include_directories(${CPP-NETLIB_SOURCE_DIR}/error/src) - -set(CPP-NETLIB_ERROR_SRCS - error.cpp) - -if(NOT CPP-NETLIB_BUILD_SINGLE_LIB) - add_library(network-error ${CPP-NETLIB_ERROR_SRCS}) -endif() - -# prepend current directory to make paths absolute -prependToElements( "${CMAKE_CURRENT_SOURCE_DIR}/" - CPP-NETLIB_ERROR_SRCS ) - -# propagate sources to parent directory for one-lib-build -set(CPP-NETLIB_ERROR_SRCS ${CPP-NETLIB_ERROR_SRCS} PARENT_SCOPE) diff --git a/error/src/error.cpp b/error/src/error.cpp deleted file mode 100644 index d4e83560d..000000000 --- a/error/src/error.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2013 by Glyn Matthews -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include - -namespace network { - - class network_category_impl : public std::error_category { - - public: - - network_category_impl() = default; - - virtual ~network_category_impl() noexcept; - - virtual const char *name() const noexcept; - - virtual std::string message(int ev) const; - - }; - - network_category_impl::~network_category_impl() noexcept { - - } - - const char *network_category_impl::name() const noexcept { - static const char name[] = "network_error"; - return name; - } - - std::string network_category_impl::message(int ev) const { - return std::strerror(ev); - } - - const std::error_category &network_category() { - static network_category_impl category; - return category; - } -} // namespace network diff --git a/error/src/network/error.hpp b/error/src/network/error.hpp deleted file mode 100644 index 3050fdaaa..000000000 --- a/error/src/network/error.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2013 by Glyn Matthews -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef NETWORK_ERROR_INC -#define NETWORK_ERROR_INC - -/** - * \defgroup error Generic Error Handling - * - * This module contains a simple function that is used in generic - * error handling inside cpp-netlib. - * - * \file - * \brief Contains a set of error classes and exceptions for - * network connections. - */ - -#include - -namespace network { - /** - * \ingroup error - * \brief Gets the error category for network errors. - * - * e.g. - * - * \code - * throw std::system_error(EPIPE, network::network_category()); - * \endcode - */ - const std::error_category &network_category(); - - /** - * \ingroup error - * \class network_exception network/error.hpp - * \brief An exception thrown in the event of a network error. - */ - class network_exception : public std::system_error { - - public: - - /** - * \brief Constructor. - * \param error_code The system error code. - */ - explicit network_exception(int error_code) - : std::system_error(error_code, network_category()) { - - } - - /** - * \brief Destructor. - */ - virtual ~network_exception() noexcept; - - }; -} // namespace network - -#endif // NETWORK_ERROR_INC diff --git a/error/test/CMakeLists.txt b/error/test/CMakeLists.txt deleted file mode 100644 index 8561ce95e..000000000 --- a/error/test/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) Glyn Matthews 2013. -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -include_directories(${CPP-NETLIB_SOURCE_DIR}/error/src - ${GTEST_INCLUDE_DIRS} - ${CPP-NETLIB_SOURCE_DIR} -) - -if (CPP-NETLIB_BUILD_TESTS) - add_executable(cpp-netlib-error_test error_test.cpp) - target_link_libraries(cpp-netlib-error_test - ${link_cppnetlib_lib} - network-error - ${Boost_LIBRARIES} - ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT}) - set_target_properties(cpp-netlib-error_test PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests) - add_test(cpp-netlib-error_test - ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-error_test) -endif() diff --git a/error/test/error_test.cpp b/error/test/error_test.cpp deleted file mode 100644 index 1bb84be1e..000000000 --- a/error/test/error_test.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Glyn Matthews 2013. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include -#include -#include - -TEST(error_test, system_error) { - std::system_error error(EPIPE, network::network_category()); - ASSERT_EQ(EPIPE, error.code().value()); -}