Skip to content

Commit

Permalink
Add kerFileAccessDisabled error code
Browse files Browse the repository at this point in the history
This can be thrown anywhere a file operation is not permitted because
exiv2 has been build with EXV_ENABLE_FILESYSTEM off.

(cherry picked from commit 5fb8c65)
  • Loading branch information
jim-easterbrook authored and mergify[bot] committed Aug 4, 2024
1 parent 42b6b8c commit 2118d60
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/exiv2/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ enum class ErrorCode {
kerArithmeticOverflow,
kerMallocFailed,
kerInvalidIconvEncoding,
kerFileAccessDisabled,

kerErrorCount,
};
Expand Down
1 change: 1 addition & 0 deletions src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ constexpr std::array errList{
N_("Arithmetic operation overflow"), // kerArithmeticOverflow
N_("Memory allocation failed"), // kerMallocFailed
N_("Cannot convert text encoding from '%1' to '%2'"), // kerInvalidIconvEncoding
N_("%1: File access disabled in exiv2 build options"), // kerFileOpenFailed %1=path
};
static_assert(errList.size() == static_cast<size_t>(Exiv2::ErrorCode::kerErrorCount),
"errList needs to contain a error msg for every ErrorCode defined in error.hpp");
Expand Down
2 changes: 1 addition & 1 deletion src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ BasicIo::UniquePtr ImageFactory::createIo(const std::string& path, [[maybe_unuse

return std::make_unique<FileIo>(path);
#else
throw Error(ErrorCode::kerFileOpenFailed, path, "", "file access disabled");
throw Error(ErrorCode::kerFileAccessDisabled, path);
#endif
} // ImageFactory::createIo

Expand Down

0 comments on commit 2118d60

Please sign in to comment.