# HG changeset patch # User nadvornik # Date 1239219150 0 # Node ID 6fdb447d87b7921bd9b0bb6e90352275cf153766 # Parent 12b0eeb5d5283f4e232f0742bd020d9407f68e62 improved Exiv2 error reporting: - use correct charset - respect --debug diff -r 12b0eeb5d528 -r 6fdb447d87b7 src/exiv2.cc --- a/src/exiv2.cc Mon Apr 06 23:59:54 2009 +0000 +++ b/src/exiv2.cc Wed Apr 08 19:32:30 2009 +0000 @@ -101,6 +101,13 @@ {NULL, NULL, NULL} }; +static void debug_exception(Exiv2::AnyError& e) +{ + gchar *str = g_locale_from_utf8(e.what(), -1, NULL, NULL, NULL); + DEBUG_1("Exiv2: %s", str); + g_free(str); +} + struct _ExifData { Exiv2::ExifData::const_iterator exifIter; /* for exif_get_next_item */ @@ -414,7 +421,7 @@ return new _ExifDataProcessed(path, sidecar_path, modified_xmp); } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } @@ -427,7 +434,7 @@ return TRUE; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return FALSE; } } @@ -439,7 +446,7 @@ return TRUE; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return FALSE; } @@ -488,7 +495,7 @@ return (ExifItem *)item; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -525,7 +532,7 @@ return (ExifItem *)item; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -563,7 +570,7 @@ } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -594,7 +601,7 @@ return NULL; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -606,7 +613,7 @@ return g_strdup(((Exiv2::Metadatum *)item)->key().c_str()); } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -618,7 +625,7 @@ return ((Exiv2::Metadatum *)item)->tag(); } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return 0; } } @@ -630,7 +637,7 @@ return ((Exiv2::Metadatum *)item)->count(); } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return 0; } } @@ -647,7 +654,7 @@ return data; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -659,7 +666,7 @@ return utf8_validate_or_convert(((Exiv2::Metadatum *)item)->tagLabel().c_str()); } catch (std::exception& e) { -// std::cout << "Caught Exiv2 exception '" << e << "'\n"; +// debug_exception(e); return NULL; } } @@ -706,7 +713,7 @@ return format_id_trans_tbl[id]; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return EXIF_FORMAT_UNKNOWN; } } @@ -718,7 +725,7 @@ return ((Exiv2::Metadatum *)item)->typeName(); } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -788,7 +795,7 @@ return 1; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return 0; } } @@ -806,7 +813,7 @@ return &ret; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -830,7 +837,7 @@ #endif } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -911,7 +918,7 @@ return 1; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return 0; } } @@ -1049,7 +1056,7 @@ } } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); } return list; } @@ -1160,7 +1167,7 @@ return NULL; } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); return NULL; } } @@ -1258,7 +1265,7 @@ } catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; + debug_exception(e); } return NULL;