[ 
https://issues.apache.org/jira/browse/LUCY-46?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755261#action_12755261
 ] 

Marvin Humphrey commented on LUCY-46:
-------------------------------------

When Err was discussed on lucy-dev...

[http://mail-archives.apache.org/mod_mbox/lucene-lucy-dev/200903.mbox/%[email protected]%3e]

... we talked about throwing real exception objects via the THROW macro, so
that we could throw (and users could catch) different subclasses of Err.  This
patch includes that feature.

{code:none}
THROW(LOCKERR, "Failed to acquire merge.lock"));
{code}

In the Perl bindings, Err has stringification overloaded so that it appears to 
be an ordinary error message unless you specifically check to verify that it's 
an object:

{code:none}
while (1) {
    my $bg_merger = eval {
        Lucy::Index::BackgroundMerger->new( index => $index );
    };
    if ( blessed($@) and $...@->isa("Lucy::Store::LockErr") ) {
        warn "Retrying...\n";
    }
    elsif (!$bg_merger) {
        # Re-throw.
        die "Failed to open BackgroundMerger: $@";
    }
    ...
}
{code}

> Err
> ---
>
>                 Key: LUCY-46
>                 URL: https://issues.apache.org/jira/browse/LUCY-46
>             Project: Lucy
>          Issue Type: Sub-task
>          Components: Core
>            Reporter: Marvin Humphrey
>            Assignee: Marvin Humphrey
>            Priority: Blocker
>         Attachments: Err.bp, Err.c, Err.c, Err.pm
>
>
> Exception class which uses the host's mechanism.  The present implementation
> has no support for catching exceptions from C, only throwing them.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to