---
name: "Lucy::Object::Err"
section: "3pm"
platform: "linux"
package: "liblucy-perl"
version: "0.3.3-7+b1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/Lucy::Object::Err"
---

# Lucy::Object::Err(3pm)

Exception.

## NAME

Lucy::Object::Err - Exception.

## SYNOPSIS

```
    use Scalar::Util qw( blessed );
    my $bg_merger;
    while (1) {
        $bg_merger = eval {
            Lucy::Index::BackgroundMerger->new( index => $index );
        };
        last if $bg_merger;
        if ( blessed($@) and $@->isa("Lucy::Store::LockErr") ) {
            warn "Retrying...\n";
        }
        else {
            # Re-throw.
            die "Failed to open BackgroundMerger: $@";
        }
    }
```

## DESCRIPTION

Most of the time when Lucy encounters an error, it tries to raise a Lucy::Object::Err exception with an error message and context information.

At present, it is only safe to catch exceptions which are specifically documented as catchable; most times when an Err is raised, Lucy leaks memory.

The Err module also provides access to a per-thread Err shared variable via *set\_error()* and *get\_error()*.  It may be used to store an Err object temporarily, so that calling code may choose how to handle a particular error condition.

## INHERITANCE

Lucy::Object::Err isa Lucy::Object::Obj.
