NAME

MongoDB::Error - MongoDB Driver Error classes

VERSION

version v0.708.3.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@mongodb.com>

  • Mike Friedman <friedo@friedo.com>

  • Kristina Chodorow <k.chodorow@gmail.com>

  • Florian Ragwitz <rafl@debian.org>

COPYRIGHT AND LICENSE

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

This is free software, licensed under:

The Apache License, Version 2.0, January 2004