diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index f59b24f6..550d1a90 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -92,7 +92,6 @@ set(LIBLOOT_INCLUDE_H_FILES
"${CMAKE_SOURCE_DIR}/include/loot/exception/error_categories.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/condition_syntax_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/cyclic_interaction_error.h"
- "${CMAKE_SOURCE_DIR}/include/loot/exception/file_access_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/exception/undefined_group_error.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/edge_type.h"
"${CMAKE_SOURCE_DIR}/include/loot/enum/game_type.h"
diff --git a/cpp/README.md b/cpp/README.md
index 2e71df2b..869c08cd 100644
--- a/cpp/README.md
+++ b/cpp/README.md
@@ -89,5 +89,5 @@ For the first layer of the wrapper, built using Cargo:
For the ABI-compatible second layer of the wrapper, built using CMake:
-- Some exceptions have changed type: they all still derive from `std::exception`, but for example some `std::logic_error` and `std::invalid_argument` exceptions have become `std::runtime_error` and `FileAccessError` exceptions, some `YAML::RepresentationException` exceptions have become `FileAccessError` exceptions, etc.
+- Some exceptions have changed type: they all still derive from `std::exception`, but for example some `std::logic_error` and `std::invalid_argument` exceptions have become `std::runtime_error` exceptions, some `YAML::RepresentationException` exceptions have become `FileAccessError` exceptions, etc.
- Exception messages are generally not expected to be the same between the two implementations.
diff --git a/cpp/docs/api/reference.rst b/cpp/docs/api/reference.rst
index 28127bd7..5f32dd42 100644
--- a/cpp/docs/api/reference.rst
+++ b/cpp/docs/api/reference.rst
@@ -98,9 +98,6 @@ Exceptions
.. doxygenclass:: loot::ConditionSyntaxError
:members:
-.. doxygenclass:: loot::FileAccessError
- :members:
-
.. doxygenclass:: loot::UndefinedGroupError
:members:
diff --git a/cpp/include/loot/api.h b/cpp/include/loot/api.h
index 7dc458a7..bdf79f33 100644
--- a/cpp/include/loot/api.h
+++ b/cpp/include/loot/api.h
@@ -37,7 +37,6 @@
#include "loot/exception/condition_syntax_error.h"
#include "loot/exception/cyclic_interaction_error.h"
#include "loot/exception/error_categories.h"
-#include "loot/exception/file_access_error.h"
#include "loot/exception/undefined_group_error.h"
#include "loot/game_interface.h"
#include "loot/loot_version.h"
diff --git a/cpp/include/loot/exception/file_access_error.h b/cpp/include/loot/exception/file_access_error.h
deleted file mode 100644
index af4ab237..00000000
--- a/cpp/include/loot/exception/file_access_error.h
+++ /dev/null
@@ -1,41 +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
- .
- */
-
-#ifndef LOOT_EXCEPTION_FILE_ACCESS_ERROR
-#define LOOT_EXCEPTION_FILE_ACCESS_ERROR
-
-#include
-
-namespace loot {
-/**
- * @brief An exception class thrown if an error is encountered while reading or
- * writing a file.
- */
-class FileAccessError : public std::runtime_error {
-public:
- using std::runtime_error::runtime_error;
-};
-}
-
-#endif
diff --git a/cpp/src/api/exception/exception.cpp b/cpp/src/api/exception/exception.cpp
index 73c0bfff..2966e718 100644
--- a/cpp/src/api/exception/exception.cpp
+++ b/cpp/src/api/exception/exception.cpp
@@ -5,7 +5,6 @@
#include "loot/exception/condition_syntax_error.h"
#include "loot/exception/cyclic_interaction_error.h"
#include "loot/exception/error_categories.h"
-#include "loot/exception/file_access_error.h"
#include "loot/exception/undefined_group_error.h"
#include "loot/vertex.h"
@@ -20,7 +19,6 @@ constexpr std::string_view UNDEFINED_GROUP_ERROR_PREFIX =
constexpr std::string_view ESPLUGIN_ERROR_PREFIX = "EspluginError: "sv;
constexpr std::string_view LIBLOADORDER_ERROR_PREFIX = "LibloadorderError: "sv;
constexpr std::string_view LCI_ERROR_PREFIX = "LciError: "sv;
-constexpr std::string_view FILE_ACCESS_ERROR_PREFIX = "FileAccessError: "sv;
constexpr std::string_view INVALID_ARGUMENT_PREFIX = "InvalidArgument: "sv;
bool startsWith(std::string_view str, std::string_view prefix) {
@@ -161,12 +159,6 @@ std::exception_ptr mapError(const ::rust::Error& error) {
return std::make_exception_ptr(ConditionSyntaxError(
code, loot_condition_interpreter_category(), details));
- } else if (startsWith(error.what(), FILE_ACCESS_ERROR_PREFIX)) {
- return std::make_exception_ptr(
- FileAccessError(getErrorSuffix(error.what())));
- } else if (startsWith(error.what(), FILE_ACCESS_ERROR_PREFIX)) {
- return std::make_exception_ptr(
- FileAccessError(getErrorSuffix(error.what())));
} else if (startsWith(error.what(), INVALID_ARGUMENT_PREFIX)) {
return std::make_exception_ptr(
std::invalid_argument(getErrorSuffix(error.what())));
diff --git a/cpp/src/error.rs b/cpp/src/error.rs
index 07545cdc..c14885a7 100644
--- a/cpp/src/error.rs
+++ b/cpp/src/error.rs
@@ -20,7 +20,6 @@ pub enum VerboseError {
CyclicInteractionError(Vec),
UndefinedGroupError(String),
SystemError(SystemError),
- FileAccessError(String),
InvalidArgument(String),
Other(Box),
}
@@ -51,7 +50,6 @@ impl std::fmt::Display for VerboseError {
};
write!(f, "{}: {}: {}", prefix, e.code(), e.message())
}
- Self::FileAccessError(s) => write!(f, "FileAccessError: {s}"),
Self::InvalidArgument(s) => write!(f, "InvalidArgument: {s}"),
Self::Other(e) => fmt_error_chain(e.as_ref(), f),
}
@@ -63,6 +61,8 @@ variant_box_from_error!(NotValidUtf8, VerboseError::Other);
variant_box_from_error!(DatabaseLockPoisonError, VerboseError::Other);
variant_box_from_error!(MultilingualMessageContentsError, VerboseError::Other);
variant_box_from_error!(RegexError, VerboseError::Other);
+variant_box_from_error!(LoadMetadataError, VerboseError::Other);
+variant_box_from_error!(WriteMetadataError, VerboseError::Other);
impl From for VerboseError {
fn from(value: GameHandleCreationError) -> Self {
@@ -89,7 +89,6 @@ impl From for VerboseError {
impl From for VerboseError {
fn from(value: SortPluginsError) -> Self {
match value {
- SortPluginsError::MetadataRetrievalError(e) => e.into(),
SortPluginsError::UndefinedGroup(g) => Self::UndefinedGroupError(g),
SortPluginsError::CycleFound(cycle) => Self::CyclicInteractionError(cycle),
SortPluginsError::PluginDataError(e) => e.into(),
@@ -117,18 +116,6 @@ impl From for VerboseError {
}
}
-impl From for VerboseError {
- fn from(value: LoadMetadataError) -> Self {
- Self::FileAccessError(value.to_string())
- }
-}
-
-impl From for VerboseError {
- fn from(value: WriteMetadataError) -> Self {
- Self::FileAccessError(value.to_string())
- }
-}
-
impl From for VerboseError {
fn from(value: ConditionEvaluationError) -> Self {
Self::SystemError(SystemError::from(value))
diff --git a/cpp/src/tests/api/interface/database_interface_test.h b/cpp/src/tests/api/interface/database_interface_test.h
index a6aad0ff..f0deec6f 100644
--- a/cpp/src/tests/api/interface/database_interface_test.h
+++ b/cpp/src/tests/api/interface/database_interface_test.h
@@ -127,7 +127,7 @@ TEST_P(DatabaseInterfaceTest,
TEST_P(DatabaseInterfaceTest,
loadMasterlistShouldThrowIfNoMasterlistIsPresent) {
EXPECT_THROW(handle_->GetDatabase().LoadMasterlist(masterlistPath),
- FileAccessError);
+ std::runtime_error);
}
TEST_P(DatabaseInterfaceTest,
@@ -146,7 +146,7 @@ TEST_P(
EXPECT_THROW(handle_->GetDatabase().LoadMasterlistWithPrelude(masterlistPath,
preludePath),
- FileAccessError);
+ std::runtime_error);
}
TEST_P(
@@ -185,7 +185,7 @@ TEST_P(DatabaseInterfaceTest,
loadUserlistShouldThrowIfAUserlistDoesNotExistAtTheGivenPath) {
ASSERT_NO_THROW(GenerateMasterlist());
EXPECT_THROW(handle_->GetDatabase().LoadUserlist(userlistPath_),
- FileAccessError);
+ std::runtime_error);
}
TEST_P(DatabaseInterfaceTest, loadUserlistShouldSucceedIfTheUserlistIsPresent) {
@@ -204,7 +204,7 @@ TEST_P(
EXPECT_THROW(
handle_->GetDatabase().WriteUserMetadata(minimalOutputPath_, false),
- FileAccessError);
+ std::runtime_error);
}
TEST_P(
@@ -238,7 +238,7 @@ TEST_P(DatabaseInterfaceTest,
EXPECT_THROW(
handle_->GetDatabase().WriteUserMetadata(minimalOutputPath_, true),
- FileAccessError);
+ std::runtime_error);
}
TEST_P(DatabaseInterfaceTest,
@@ -753,7 +753,7 @@ TEST_P(
EXPECT_THROW(
handle_->GetDatabase().WriteMinimalList(minimalOutputPath_, false),
- FileAccessError);
+ std::runtime_error);
}
TEST_P(
@@ -787,7 +787,7 @@ TEST_P(DatabaseInterfaceTest,
EXPECT_THROW(
handle_->GetDatabase().WriteMinimalList(minimalOutputPath_, true),
- FileAccessError);
+ std::runtime_error);
}
TEST_P(DatabaseInterfaceTest,
diff --git a/python/README.md b/python/README.md
index 4cbf28e3..5cb56c5a 100644
--- a/python/README.md
+++ b/python/README.md
@@ -47,5 +47,5 @@ python
- The Python exceptions that errors are mapped to are not the same as in the Rust or C++ interfaces:
- The API provides the custom `CyclicInteractionError`, `UndefinedGroupError`, `EspluginError` exception types.
- All other errors are raised as `ValueError` exceptions.
- - There's no equivalent to the C++ interface's `FileAccessError` or `ConditionSyntaxError` classes or the libloadorder and loot-condition-interpreter system error categories.
+ - There's no equivalent to the C++ interface's `ConditionSyntaxError` class or the libloadorder and loot-condition-interpreter system error categories.
- The `LogLevel` enum and `set_logging_callback()` and `set_log_level()` functions are not exposed because the logging is integrated with Python's `logging` module instead.