* mu-(query|store)-xapian.cc, mu-util.h: define/use macro for catch blocks to

declutter my code
This commit is contained in:
Dirk-Jan C. Binnema
2010-01-05 08:32:23 +02:00
parent e28b9dcdf3
commit 4bc30783b1
3 changed files with 66 additions and 105 deletions

View File

@ -57,6 +57,37 @@ char* mu_util_guess_maildir (void);
*/
gboolean mu_util_create_dir_maybe (const gchar *path);
/**
*
* don't repeat this catch blocks everywhere...
*
*/
#define MU_UTIL_XAPIAN_CATCH_BLOCK \
catch (const Xapian::Error &err) { \
g_warning ("%s: caught xapian exception '%s' (%s)", \
__FUNCTION__, err.get_msg().c_str(), \
err.get_error_string()); \
} catch (...) { \
g_warning ("%s: caught exception", __FUNCTION__); \
}
#define MU_UTIL_XAPIAN_CATCH_BLOCK_RETURN(R) \
catch (const Xapian::Error &err) { \
g_warning ("%s: caught xapian exception '%s' (%s)", \
__FUNCTION__, err.get_msg().c_str(), \
err.get_error_string()); \
return (R); \
} catch (...) { \
g_warning ("%s: caught exception", __FUNCTION__); \
return (R); \
}
G_END_DECLS
#endif /*__MU_UTIL_H__*/