Remove obsolete Error class

This commit is contained in:
Oliver Hamlet
2016-10-08 12:21:08 +01:00
parent 2ec9ab29ac
commit 00be5fd206
30 changed files with 12 additions and 135 deletions
-2
View File
@@ -219,7 +219,6 @@ set (LOOT_HEADERS "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.h"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/version.h"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/yaml_set_helpers.h"
"${CMAKE_SOURCE_DIR}/include/loot/api_decorator.h"
"${CMAKE_SOURCE_DIR}/include/loot/error.h"
"${CMAKE_SOURCE_DIR}/include/loot/error_categories.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/condition_syntax_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/cyclic_interaction_error.h"
@@ -283,7 +282,6 @@ set (LOOT_API_SRC "${CMAKE_BINARY_DIR}/generated/loot_version.cpp"
set (LOOT_API_HEADERS "${CMAKE_SOURCE_DIR}/include/loot/api.h"
"${CMAKE_SOURCE_DIR}/include/loot/api_decorator.h"
"${CMAKE_SOURCE_DIR}/include/loot/database_interface.h"
"${CMAKE_SOURCE_DIR}/include/loot/error.h"
"${CMAKE_SOURCE_DIR}/include/loot/error_categories.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/condition_syntax_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/cyclic_interaction_error.h"
+6 -6
View File
@@ -43,6 +43,12 @@ Interfaces
Classes
=======
.. doxygenclass:: loot::LootVersion
:members:
Exceptions
==========
.. doxygenclass:: loot::CyclicInteractionError
:members:
@@ -58,12 +64,6 @@ Classes
.. doxygenclass:: loot::FileAccessError
:members:
.. doxygenclass:: loot::Error
:members:
.. doxygenclass:: loot::LootVersion
:members:
Error Categories
================
-1
View File
@@ -30,7 +30,6 @@
#include "loot/api_decorator.h"
#include "loot/database_interface.h"
#include "loot/error.h"
#include "loot/error_categories.h"
#include "loot/exception/condition_syntax_error.h"
#include "loot/exception/cyclic_interaction_error.h"
-91
View File
@@ -1,91 +0,0 @@
/* LOOT
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
Fallout: New Vegas.
Copyright (C) 2012-2016 WrinklyNinja
This file is part of LOOT.
LOOT is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
LOOT is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LOOT. If not, see
<https://www.gnu.org/licenses/>.
*/
#ifndef LOOT_ERROR
#define LOOT_ERROR
#include <exception>
#include <string>
namespace loot {
/**
* @brief A class that defines the type of objects thrown as errors by the LOOT
* API.
* @details Note that not all exceptions thrown from the LOOT API use this type,
* so catch `std::exception` too.
*/
class Error : public std::exception {
public:
/**
* @brief A code indicating the type of error that occurred.
*/
enum struct Code : unsigned int {
/**
* No error occurred. This is used internally to indicate that an operation
* failed, but its failure was not fatal to the task being performed.
*/
ok = 0,
};
/**
* @brief Construct an error object giving a code and error message.
*/
Error(const Code code_arg, const std::string& what_arg) : code_(code_arg), what_(what_arg) {}
~Error() throw() {};
/**
* @brief Get the code describing the type of error that occurred.
* @return An error code.
*/
Code code() const { return code_; }
/**
* @brief A utility function that casts the code to an unsigned int.
* @return An error code's unsigned integer value.
*/
unsigned int codeAsUnsignedInt() const {
return asUnsignedInt(code_);
}
/**
* @brief Get the message that describes the error details.
* @return A string describing the error that occurred.
*/
const char * what() const throw() { return what_.c_str(); }
/**
* A utility function that converts a given error code to an unsigned int.
* @param code The code to convert.
* @return The error code's unsigned integer value.
*/
static unsigned int asUnsignedInt(Code code) {
return static_cast<unsigned int>(code);
}
private:
Code code_;
std::string what_;
};
}
#endif
-1
View File
@@ -28,7 +28,6 @@
#include <boost/log/core.hpp>
#include "api/api_database.h"
#include "loot/error.h"
#include "backend/app/loot_paths.h"
namespace fs = boost::filesystem;
-1
View File
@@ -27,7 +27,6 @@
#include <vector>
#include <unordered_map>
#include "loot/error.h"
#include "loot/exception/file_access_error.h"
#include "backend/game/game.h"
#include "backend/plugin/plugin_sorter.h"
-1
View File
@@ -28,7 +28,6 @@ Fallout: New Vegas.
#include <boost/locale.hpp>
#include "loot/error.h"
#include "backend/helpers/helpers.h"
#ifdef _WIN32
+1 -2
View File
@@ -34,7 +34,6 @@
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/utility/setup/file.hpp>
#include "loot/error.h"
#include "loot/exception/game_detection_error.h"
#include "backend/app/loot_paths.h"
#include "backend/helpers/helpers.h"
@@ -189,7 +188,7 @@ void LootState::init(const std::string& cmdLineGame) {
storeGameSettings(toGameSettings(games_));
} catch (GameDetectionError& e) {
initErrors_.push_back(e.what());
} catch (Error &e) {
} catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "Game-specific settings could not be initialised. " << e.what();
initErrors_.push_back((format(translate("Error: Game-specific settings could not be initialised. %1%")) % e.what()).str());
}
-1
View File
@@ -32,7 +32,6 @@
#include <boost/log/trivial.hpp>
#include "backend/app/loot_paths.h"
#include "loot/error.h"
#include "loot/exception/file_access_error.h"
#include "loot/exception/game_detection_error.h"
#include "backend/helpers/helpers.h"
-1
View File
@@ -30,7 +30,6 @@
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
#include "loot/error.h"
#include "backend/helpers/helpers.h"
using boost::locale::to_lower;
-1
View File
@@ -29,7 +29,6 @@
#include <boost/log/trivial.hpp>
#include "backend/app/loot_paths.h"
#include "loot/error.h"
#include "backend/helpers/helpers.h"
namespace fs = boost::filesystem;
+1 -2
View File
@@ -28,7 +28,6 @@
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
#include "loot/error.h"
#include "loot/error_categories.h"
using boost::locale::translate;
@@ -182,7 +181,7 @@ void LoadOrderHandler::SetLoadOrder(const std::vector<std::string>& loadOrder) c
try {
SetLoadOrder(pluginArr, pluginArrSize);
} catch (Error &/*e*/) {
} catch (std::exception& /*e*/) {
for (size_t i = 0; i < pluginArrSize; i++)
delete[] pluginArr[i];
delete[] pluginArr;
-1
View File
@@ -28,7 +28,6 @@
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
#include "loot/error.h"
#include "loot/error_categories.h"
#include "loot/exception/git_state_error.h"
-1
View File
@@ -40,7 +40,6 @@
#include <boost/log/trivial.hpp>
#include <boost/spirit/include/karma.hpp>
#include "loot/error.h"
#include "loot/exception/file_access_error.h"
#ifdef _WIN32
@@ -26,7 +26,6 @@
#include <boost/log/trivial.hpp>
#include "loot/error.h"
#include "backend/helpers/helpers.h"
namespace loot {
-1
View File
@@ -46,7 +46,6 @@
#include <boost/spirit/include/phoenix_bind.hpp>
#include <boost/spirit/include/qi.hpp>
#include "loot/error.h"
#include "loot/exception/condition_syntax_error.h"
#include "backend/game/game.h"
#include "backend/helpers/helpers.h"
-1
View File
@@ -26,7 +26,6 @@
#include <boost/log/trivial.hpp>
#include "loot/error.h"
#include "backend/game/game.h"
#include "backend/helpers/language.h"
-1
View File
@@ -32,7 +32,6 @@
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
#include "loot/error.h"
#include "backend/game/game.h"
#include "backend/helpers/helpers.h"
-1
View File
@@ -28,7 +28,6 @@
#include <boost/filesystem/fstream.hpp>
#include <boost/log/trivial.hpp>
#include "loot/error.h"
#include "loot/exception/file_access_error.h"
#include "backend/game/game.h"
-1
View File
@@ -34,7 +34,6 @@
#include <boost/locale.hpp>
#include <boost/log/trivial.hpp>
#include "loot/error.h"
#include "loot/exception/cyclic_interaction_error.h"
#include "backend/game/game.h"
#include "backend/helpers/helpers.h"

Some files were not shown because too many files have changed in this diff Show More