On Wed, Aug 09, 2017 at 04:42:29PM +0800, 李猛 wrote:> I am a student in China and I am using Xapian to do some projects
> recently, for the error DatabaseModifiedError i dont know how to catch
> it in java, i do not find the relative class in xapian.jar.
The Xapian exception classes aren't wrapped for Java at the moment, so
currently you'll get a java.io.IOException exception, and you can check
for DatabaseModifiedError using code like this (untested):
try {
// Code which might cause DatabaseModifiedError.
} catch (Exception e) {
if (e.toString().startsWith("DatabaseModifiedError:")) {
// Deal with it.
}
}
It'd be nicer to wrap and throw the Xapian::Error subclasses, which
shouldn't be very hard to sort out - if you or anyone else is
interested in doing this, I'm happy to point out how (same goes for C#
and Ruby, which also don't currently wrap the exception classes).
Cheers,
Olly