views:

295

answers:

2

Help with using the xapian php wrapper.

I have a couple of custom exception handlers for different categories of errors (I'm thinking of seperating them out more).
Xapian handles errors by throwing standard Exception objects. I would like to use a custom exception handler for these though. How do I go about using a custom exception for a standard Exception that has already been thrown? Or any other ideas, perhaps how to get Xapian to throw some other exception type?

+1  A: 

the kludgy way: wrap every xapian API call in try..catch blocks, and throw more specific custom exceptions in the catch clause.

or the hackish way: modify the source of the xapian php extension (which i assume is written in C?) to throw custom exceptions (that you would also have to define in the extension source)

TimTowdi
A: 

Catch the generic exceptions from Xapian, figure out what they are, then throw more specific expections.

Or...if you'd like Xapian to behave differently than it currently does, well, it is an open source project. You know what to do. :)

Sean