diff --git a/include/exiv2/error.hpp b/include/exiv2/error.hpp index 6b7e18e408..bb72eabcef 100644 --- a/include/exiv2/error.hpp +++ b/include/exiv2/error.hpp @@ -224,6 +224,7 @@ enum class ErrorCode { kerArithmeticOverflow, kerMallocFailed, kerInvalidIconvEncoding, + kerFileAccessDisabled, kerErrorCount, }; diff --git a/src/error.cpp b/src/error.cpp index 135f4730d8..1216788179 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -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(Exiv2::ErrorCode::kerErrorCount), "errList needs to contain a error msg for every ErrorCode defined in error.hpp"); diff --git a/src/image.cpp b/src/image.cpp index a71e8646d2..3f149e683c 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -797,7 +797,7 @@ BasicIo::UniquePtr ImageFactory::createIo(const std::string& path, [[maybe_unuse return std::make_unique(path); #else - throw Error(ErrorCode::kerFileOpenFailed, path, "", "file access disabled"); + throw Error(ErrorCode::kerFileAccessDisabled, path); #endif } // ImageFactory::createIo