Skip to content

Commit

Permalink
Add key name to "Value not set" error message (#2149)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jim-easterbrook authored Mar 14, 2022
1 parent 173ebb2 commit 04ae6c2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/exif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace Exiv2 {
const Value& Exifdatum::value() const
{
if (!value_)
throw Error(ErrorCode::kerValueNotSet);
throw Error(ErrorCode::kerValueNotSet, key());
return *value_;
}

Expand Down
2 changes: 1 addition & 1 deletion src/iptc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ namespace Exiv2 {
const Value& Iptcdatum::value() const
{
if (!value_)
throw Error(ErrorCode::kerValueNotSet);
throw Error(ErrorCode::kerValueNotSet, key());
return *value_;
}

Expand Down
2 changes: 1 addition & 1 deletion src/xmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
}

Expand Down

0 comments on commit 04ae6c2

Please sign in to comment.