c5b392
diff --git a/src/gcm-helper-exiv.cpp b/src/gcm-helper-exiv.cpp
c5b392
index 9854e79..7ec6994 100644
c5b392
--- a/src/gcm-helper-exiv.cpp
c5b392
+++ b/src/gcm-helper-exiv.cpp
c5b392
@@ -21,6 +21,12 @@
c5b392
 
c5b392
 #include <exiv2/image.hpp>
c5b392
 #include <exiv2/exif.hpp>
c5b392
+
c5b392
+#if EXIV2_MAJOR_VERSION >= 1 || (EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION >= 27)
c5b392
+#define HAVE_EXIV2_ERROR_CODE
c5b392
+#include <exiv2/error.hpp>
c5b392
+#endif
c5b392
+
c5b392
 #include <iostream>
c5b392
 #include <iomanip>
c5b392
 
c5b392
@@ -51,7 +57,11 @@ main (int argc, char* const argv[])
c5b392
 		if (argc == 2)
c5b392
 			filename = argv[1];
c5b392
 		if (filename.empty())
c5b392
+#ifdef HAVE_EXIV2_ERROR_CODE
c5b392
+			throw Exiv2::Error(Exiv2::kerErrorMessage, "No filename specified");
c5b392
+#else
c5b392
 			throw Exiv2::Error(1, "No filename specified");
c5b392
+#endif
c5b392
 		image = Exiv2::ImageFactory::open(filename);
c5b392
 		image->readMetadata();
c5b392
 
c5b392
@@ -60,7 +70,11 @@ main (int argc, char* const argv[])
c5b392
 		if (exifData.empty()) {
c5b392
 			std::string error(argv[1]);
c5b392
 			error += ": No Exif data found in the file";
c5b392
+#ifdef HAVE_EXIV2_ERROR_CODE
c5b392
+			throw Exiv2::Error(Exiv2::kerErrorMessage, error);
c5b392
+#else
c5b392
 			throw Exiv2::Error(1, error);
c5b392
+#endif
c5b392
 		}
c5b392
 
c5b392
 		/* try to find make, model and serial number */