Exceptions

Classes used to represent exceptions. When using the MetagenomeDB API it is recommended to use the try/except syntax to catch such exceptions and display meaningful error messages. For example:

import MetagenomeDB as mdb

try:
        mdb.connect(database = "My database")

# here we catch any exception related to the database connection
except mdb.ConnectionError as msg:
        print "Connection error: %s" % msg

# here we catch any other exception thrown by the toolkit
except mdb.MetagenomeDBerror as msg:
        print "General error: %s" % msg

(see the Python documentation about handling exceptions)

exception MetagenomeDB.errors.ConnectionError(database, host, port, message)[source]

Exception that is raised when failing to connect to a MongoDB server.

exception MetagenomeDB.errors.DuplicateObjectError(object_type, duplicate_properties=None, message=None)[source]

Exception that is raised when attempting to add an object in the database while a formerly imported object already exists with the same values for one or more unique properties.

exception MetagenomeDB.errors.InvalidObjectError[source]

Exception thrown when an object is created with incorrect initial parameters.

exception MetagenomeDB.errors.MetagenomeDBError[source]

Base class for all MetagenomeDB exceptions.

exception MetagenomeDB.errors.UncommittedObjectError[source]

Exception thrown when an operation is performed on an uncommitted object that requires this object to be committed.

Previous topic

Additional functions

Next topic

Tools Documentation