How to deal with xapian php exceptions

Help using xapian php wrapper.

I have several custom exception handlers for different error categories (I think there is more to separate them).
Xapian handles errors by throwing standard Exception objects. I would like to use a custom exception handler for them. How can I use 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 type of exception?

+1


source to share


2 answers


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



or in a hacky way: change the xapian php extension source (which I assume is written in C?) to throw custom exceptions (which you also need to define in the extension source)

+1


source


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



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

0


source







All Articles