Skip to content

Commit 04ae6c2

Browse files
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.
1 parent 173ebb2 commit 04ae6c2

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/error.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace
2323
N_("Invalid record name '%1'"), // kerInvalidRecord %1=record name
2424
N_("Invalid key '%1'"), // kerInvalidKey %1=key
2525
N_("Invalid tag name or ifdId `%1', ifdId %2"), // kerInvalidTag %1=tag name, %2=ifdId
26-
N_("Value not set"), // kerValueNotSet
26+
N_("%1 value not set"), // kerValueNotSet %1=key name
2727
N_("%1: Failed to open the data source: %2"), // kerDataSourceOpenFailed %1=path, %2=strerror
2828
N_("%1: Failed to open file (%2): %3"), // kerFileOpenFailed %1=path, %2=mode, %3=strerror
2929
N_("%1: The file contains data of an unknown image type"), // kerFileContainsUnknownImageType %1=path

src/exif.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ namespace Exiv2 {
205205
const Value& Exifdatum::value() const
206206
{
207207
if (!value_)
208-
throw Error(ErrorCode::kerValueNotSet);
208+
throw Error(ErrorCode::kerValueNotSet, key());
209209
return *value_;
210210
}
211211

src/iptc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ namespace Exiv2 {
131131
const Value& Iptcdatum::value() const
132132
{
133133
if (!value_)
134-
throw Error(ErrorCode::kerValueNotSet);
134+
throw Error(ErrorCode::kerValueNotSet, key());
135135
return *value_;
136136
}
137137

src/xmp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ namespace Exiv2 {
369369
const Value& Xmpdatum::value() const
370370
{
371371
if (!p_->value_)
372-
throw Error(ErrorCode::kerValueNotSet);
372+
throw Error(ErrorCode::kerValueNotSet, key());
373373
return *p_->value_;
374374
}
375375

0 commit comments

Comments
 (0)