com.mongodb
Class MongoException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.mongodb.MongoException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CommandFailureException, MongoException.CursorNotFound, MongoException.Network, MongoInternalException, MongoInterruptedException, WriteConcernException

public class MongoException
extends RuntimeException

A general exception raised in Mongo

Author:
antoine
See Also:
Serialized Form

Nested Class Summary
static class MongoException.CursorNotFound
          Subclass of MongoException representing a cursor-not-found exception
static class MongoException.DuplicateKey
          Subclass of WriteConcernException representing a duplicate key error
static class MongoException.Network
          Subclass of MongoException representing a network-related exception
 
Constructor Summary
MongoException(BSONObject o)
          Creates a MongoException from a BSON object representing an error
MongoException(int code, String msg)
           
MongoException(int code, String msg, Throwable t)
           
MongoException(String msg)
           
MongoException(String msg, Throwable t)
           
 
Method Summary
 int getCode()
          Gets the exception code
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MongoException

public MongoException(String msg)
Parameters:
msg - the message

MongoException

public MongoException(int code,
                      String msg)
Parameters:
code - the error code
msg - the message

MongoException

public MongoException(String msg,
                      Throwable t)
Parameters:
msg - the message
t - the throwable cause

MongoException

public MongoException(int code,
                      String msg,
                      Throwable t)
Parameters:
code - the error code
msg - the message
t - the throwable cause

MongoException

public MongoException(BSONObject o)
Creates a MongoException from a BSON object representing an error

Parameters:
o -
Method Detail

getCode

public int getCode()
Gets the exception code

Returns: