The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MongoDB::Error - MongoDB Driver Error classes

VERSION

version v0.707.2.0

SYNOPSIS

    use MongoDB::Error;

    MongoDB::Error->throw("a generic error");

    MongoDB::DatabaseError->throw(
        message => $string,
        result => $hashref,
    );

DESCRIPTION

This class defines a heirarchy of exception objects.

METHODS

throw

    MongoDB::Error->throw("message");
    MongoDB::Error->throw(
        msg => "message",
        result => $data,
    );
    MongoDB::Error->throw( $error_object );

EXCEPTION HIERARCHY

All classes inherit from MongoDB::Error.

All error classes have the attribute:

  • message — a text representation of the error

MongoDB::ConnectionError

Errors related to network connections.

MongoDB::DatabaseError

Errors related to database operations.

Attributes include:

  • result — response from a database command; this must impliement the last_errmsg method

MongoDB::WriteError

Errors indicating failure of a write command. The result attribute is a MongoDB::WriteResult object.

MongoDB::WriteConcernError

Errors indicating failure of a write concern. The result attribute is a MongoDB::WriteResult object.

MongoDB::DocumentSizeError

Errors from documents exceeding the maximum allowable size.

Attributes include:

  • document — the document that caused the error

AUTHORS

  • David Golden <david.golden@mongodb.org>

  • Mike Friedman <friedo@mongodb.com>

  • Kristina Chodorow <kristina@mongodb.org>

  • Florian Ragwitz <rafl@debian.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2014 by MongoDB, Inc..

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004