[gthumb/ext] catch any type of error when reading and writing metadata
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] catch any type of error when reading and writing metadata
- Date: Sat, 29 Aug 2009 18:08:32 +0000 (UTC)
commit a6880db1b4724c4c98da781207f18aae05d7115b
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Aug 29 20:07:06 2009 +0200
catch any type of error when reading and writing metadata
[bug #593411]
extensions/exiv2/exiv2-utils.cpp | 27 +++++++++------------------
1 files changed, 9 insertions(+), 18 deletions(-)
---
diff --git a/extensions/exiv2/exiv2-utils.cpp b/extensions/exiv2/exiv2-utils.cpp
index 4826882..d522ac6 100644
--- a/extensions/exiv2/exiv2-utils.cpp
+++ b/extensions/exiv2/exiv2-utils.cpp
@@ -382,13 +382,9 @@ exiv2_read_metadata_from_file (GFile *file,
exiv2_read_metadata (image, info);
}
- /*catch (Exiv2::AnyError& e) {
- std::cerr << "Caught Exiv2 exception '" << e << "'\n";
- return FALSE;
- }*/
- catch (char *msg) {
+ catch (Exiv2::AnyError& e) {
if (error != NULL)
- *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, msg);
+ *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what());
return FALSE;
}
@@ -414,14 +410,9 @@ exiv2_read_metadata_from_buffer (void *buffer,
exiv2_read_metadata (image, info);
}
- catch (Exiv2::Error) {
- if (error != NULL)
- *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid file format"));
- return FALSE;
- }
- catch (char *msg) {
+ catch (Exiv2::AnyError& e) {
if (error != NULL)
- *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, msg);
+ *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what());
return FALSE;
}
@@ -470,7 +461,7 @@ exiv2_read_sidecar (GFile *file,
set_attributes_from_tagsets (info);
}
catch (Exiv2::AnyError& e) {
- std::cout << "Caught Exiv2 exception '" << e << "'\n";
+ std::cerr << "Caught Exiv2 exception '" << e << "'\n";
return FALSE;
}
@@ -662,9 +653,9 @@ exiv2_write_metadata (SavePixbufData *data)
data->buffer = g_memdup (buf.pData_, buf.size_);
data->buffer_size = buf.size_;
}
- catch (char *msg) {
+ catch (Exiv2::AnyError& e) {
if (data->error != NULL)
- *data->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, msg);
+ *data->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what());
return FALSE;
}
@@ -690,9 +681,9 @@ exiv2_write_metadata_to_buffer (void **buffer,
*buffer = g_memdup (buf.pData_, buf.size_);
*buffer_size = buf.size_;
}
- catch (char *msg) {
+ catch (Exiv2::AnyError& e) {
if (error != NULL)
- *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, msg);
+ *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, e.what());
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]