Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions include/errors/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,6 @@ class Error {
* @endcode
*/
friend std::ostream& operator<<(std::ostream& os, const errors::Error& err);

/**
* @brief Checks if two error objects are equal.
* @param lhs The left-hand side error object.
* @param rhs The right-hand side error object.
* @return True if equal, false otherwise.
*
* This operator allows the comparison of two error objects using the == operator.
*
* @code{.cpp}
* const auto err = errors::make("unknown error");
* const auto other_err = err;
*
* assert(err == other_err);
* @endcode
*/
friend bool operator==(const Error& lhs, const Error& rhs);

/**
* @brief Checks if two error objects are not equal.
* @param lhs The left-hand side error object.
* @param rhs The right-hand side error object.
* @return True if not equal, false otherwise.
*
* This operator allows the comparison of two error objects using the != operator.
*
* @code{.cpp}
* const auto err = errors::make("unknown error");
* const auto other_err = errors::make("other error");
*
* assert(err != other_err);
* @endcode
*/
friend bool operator!=(const Error& lhs, const Error& rhs);
};

/**
Expand Down
8 changes: 0 additions & 8 deletions src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ std::ostream& operator<<(std::ostream& os, const errors::Error& err) {
return os << "error: " << err.message();
}

bool operator==(const Error& lhs, const Error& rhs) {
return lhs.message() == rhs.message();
}

bool operator!=(const Error& lhs, const Error& rhs) {
return lhs.message() != rhs.message();
}

Error make(const std::string& msg) {
return Error(std::make_shared<const std::string>(msg));
}
Expand Down
10 changes: 0 additions & 10 deletions test/error_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ TEST_CASE("Error Construction With Formatting") {
REQUIRE(err.message() == "HTTP error 404");
}

TEST_CASE("Error Comparison") {
const auto err = errors::make("unknown error");
const auto err_copy = err;
CHECK(err == err_copy);
CHECK_FALSE(err != err_copy);
const auto other_err = errors::make("other error");
CHECK_FALSE(err == other_err);
CHECK(err != other_err);
}

TEST_CASE("Error Printing") {
const auto err = errors::make("unknown error");

Expand Down