Add key name to "Value not set" error message (#2149)

The error typically occurs when writeMetadata() is called. It's easier
to find the problem if you know which datum hasn't had a value set.
main
Jim Easterbrook 3 years ago committed by GitHub
parent 173ebb2931
commit 04ae6c2c4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,7 +23,7 @@ namespace
N_("Invalid record name '%1'"), // kerInvalidRecord %1=record name
N_("Invalid key '%1'"), // kerInvalidKey %1=key
N_("Invalid tag name or ifdId `%1', ifdId %2"), // kerInvalidTag %1=tag name, %2=ifdId
N_("Value not set"), // kerValueNotSet
N_("%1 value not set"), // kerValueNotSet %1=key name
N_("%1: Failed to open the data source: %2"), // kerDataSourceOpenFailed %1=path, %2=strerror
N_("%1: Failed to open file (%2): %3"), // kerFileOpenFailed %1=path, %2=mode, %3=strerror
N_("%1: The file contains data of an unknown image type"), // kerFileContainsUnknownImageType %1=path

@ -205,7 +205,7 @@ namespace Exiv2 {
const Value& Exifdatum::value() const
{
if (!value_)
throw Error(ErrorCode::kerValueNotSet);
throw Error(ErrorCode::kerValueNotSet, key());
return *value_;
}

@ -131,7 +131,7 @@ namespace Exiv2 {
const Value& Iptcdatum::value() const
{
if (!value_)
throw Error(ErrorCode::kerValueNotSet);
throw Error(ErrorCode::kerValueNotSet, key());
return *value_;
}

@ -369,7 +369,7 @@ namespace Exiv2 {
const Value& Xmpdatum::value() const
{
if (!p_->value_)
throw Error(ErrorCode::kerValueNotSet);
throw Error(ErrorCode::kerValueNotSet, key());
return *p_->value_;
}

Loading…
Cancel
Save