Opened 17 years ago
Closed 16 years ago
#230 closed defect (fixed)
C++-exceptions are not wrapped for Perl
Reported by: | Andreas Marienborg | Owned by: | Olly Betts |
---|---|---|---|
Priority: | normal | Milestone: | 1.1.0 |
Component: | Search::Xapian | Version: | SVN trunk |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Operating System: | All |
Description (last modified by )
This results in exceptions being uncatchable, or catchable as string-exceptions.
Attachments (2)
Change History (10)
comment:1 by , 17 years ago
Owner: | changed from | to
---|
comment:2 by , 17 years ago
Status: | new → assigned |
---|---|
Summary: | C++-exceptions are not wrapped → C++-exceptions are not wrapped for Perl |
comment:3 by , 17 years ago
yes, the Enquire.xs is just a test basicly, and I agree that having the try/catch further out might be better.
I could have sworn the sorting was there for a reason, but I can't remember it now :) I'll try it without it, and see what breaks
comment:4 by , 17 years ago
attachments.isobsolete: | 0 → 1 |
---|---|
Operating System: | → All |
comment:5 by , 17 years ago
Note that none of the Weight object constructors will actually throw exceptions...
BTW, in the longer term, I'm hoping to move the Perl bindings to use SWIG so that they don't need manually updating for every API change. However, SWIG currently lacks support for "directors" in Perl (directors allow subclassing C++ classes in the wrapping language). So someone (possibly me) needs to sort that out first (there is an old patch for it, which never got merged for some reason).
I'm not trying to discourage work on this (it's certainly useful) but I thought you should be aware of this plan. I'd probably suggest wrapping the methods which matter most to you to start with.
comment:6 by , 17 years ago
any easy way to know what methods can throw exceptions and which can not?
I don't mind it being replaced down the road, it's not like its a lot of work :)
As long as I won't have to keep maintaining my own local copy of this, I'm happy
comment:7 by , 17 years ago
I think I have wrapped the most essential ones for me in Database and Enquire, so if everything looks a-ok, feel free to apply, and I can just make smaller patches with more wrappings later, if thats ok
comment:9 by , 17 years ago
Description: | modified (diff) |
---|---|
Milestone: | → 1.1.0 |
We should try to get this in for 1.1.0.
comment:10 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Applied (with some reworking) to trunk as r11714.
I suspect you're likely to get better generated code if you wrap the whole of the possible exception-causing part of each XS wrapper in a try/catch rather than each case of a switch statement individually. Certainly worth checking before wrapping every method by hand!
Also, (@baseclasses, @classes) should already be in dependency order (this may not be documented but other users require it so it can definitely be relied on), so sticking it into a hash and then carefully building a dependency order isn't necessary.